+ 9

# Challenge #1: 3D array motion

For these challenges, you are required to write code, you may use the playground if you so wish. Problem: A cube volume of 1,728mÂ³ represents our 3D space. An 1mÂ³ volume cube can move around inside of it 1m at a time. The center of that cube is relative 0 and it sits at global {4.5, 4.5, 4.5} of the cube it resides in. Using array logic, write a code to solve the transversal from 0 to a point 4m up, 2m right, and 7m deep. Pseudo code is also acceptable in place of real code. The concept is all that matters.

2 Answers

+ 8

I realize the mistake and modified the question, but your answer still isn't correct. 1). it's not in code or pseudo code, 2). it's not actually solving the problem, and 3). it's not the correct outcome. Sorry for the size mix-up, try again though? ^_^ P.S. you may miss understand what I mean by psuedo code, I mean an actual code snippet that could be used to solve the problem. Think of it like a real code snippet, but not in a actual language.

+ 4

every side of the cube is composed of 9 segments by 1mt equivalent to 9 units.
the center is located at coordinates (5,5,5) that describe the units for height width and depth.
new center will be at(-4,+2,+7) that is equivalent to coordinates (0#not counting the origin in the subtraction#,7,12) that correspond to height, width and depth.
the new origin is out of the 3D space.
you have to start wit a bigger array for your 3D space!
you can use a tridimensional array:
3 arrays of 16 elements each.
every unit cube inside the 3D space is described by the coordinates of height width and length.
3dSpace[5][5][5] represents the initial origin
translation will be
3dSpace[x-1-4][y+2][z+7] where x represents the coordinates of any unit cube in the 3dspace.
In processing there is a translate function that handles this type of transformations
translate(-4, 2,7); like magic.