My best guess is this fits in algebra, I've been scratching my head with this for a while.(adsbygoogle = window.adsbygoogle || []).push({});

I have a three dimensional array representing points of certain objects in a game.

int [5,5,5] currentLocs

I want to be able to rotate these 3d points around the center in any direction by 90 degrees. So like taking a dice and turning from side to side.

In doing it on paper I've noticed that often there's a pattern of finding the difference between the current position in relation to one of the axis not being rotated around and the max value of that axis, but nothing that applies to all points and all rotations.

I want to rotate either direction around any of the three axis and know where each data point should be within the three dimensional array afterwards.

EXAMPLE:

three objects stored as a column with one in a corner in a 3D array

y=2 y=1 y=0

100 000 000

010 010 010

000 000 000

rotated around the X axis would become a horizontal line with the corner object moving to another corner

y=2 y=1 y=0

000 010 100

000 010 000

000 010 000

Any ideas? Most rotation stuff I find involves rotating based on the orientation of a center point and doing matrix multiplication. This works great for rotating a model and what not, but I haven't figured out a way to apply this to my desired technique that can be applied to any cubic odd numbered 3D array. Surely there's some simple proof as to how each coordinate moves to another as the grid rotates.

Thanks

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Method for rotating data points in 3 dimensions

**Physics Forums | Science Articles, Homework Help, Discussion**