Method for rotating data points in 3 dimensions

Disputed
Messages
4
Reaction score
0
My best guess is this fits in algebra, I've been scratching my head with this for a while.

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 news on Phys.org
Disputed said:
I have a three dimensional array representing points of certain objects in a game.

int [5,5,5] currentLocs
So these are voxels? Then it would be misleading to say that they represents points of certain objects in a game. If you truly had an array representing points in a game your array would probably look more like:
int [10,3] currentLocs;
for 10 objects in 3-dimensional space. If this is really what you wanted, then just calculate the rotation matrix for rotation around the appropriate axis (see http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations").

If you really wanted the voxel-based data structure (in which case you should use a much larger array than 5x5x5), then the basic idea is that if you want to do a w rad rotation around some axis you just calculate the appropriate rotation matrix, but instead calculate it for a rotation of -w. Then if you apply it to a point (x,y,z) you find from which voxel that point comes from, and therefore what value to assign to it.

I wouldn't mind providing some more details if you could expand on exactly how your data is represented (are 0 and 1 for instance the only permissible values), and what you're having trouble with.
 
Last edited by a moderator:
Essentially I have a 5x5x5 grid, either 0 (there is nothing) or 1 (there is a block) present. I want to rotate where these blocks are around the center grid point, and this is all stored in the array as mentioned. Every rotation is 90 degrees, hence why I mention moving from side to side or rolling dice. So if I have a block at x,y,z in the array, I want to know how to find the NEW x,y,z based on rotating any of the six possible directions. (clockwise or counter clockwise around each axis). I hope this clarified what I'm trying to do. Like a rubix cube, if I rotate it, I need to know where to move the colors, but not just on the outer walls, also internally in each grip point withe the exception of the center which of course will not move.
 
Here are some matrix transformations that will rotate the elements 90 degrees.
For a clockwise rotation:

B = A^{T} <br /> \[ \left[ \begin{array}{ccc}<br /> 0 &amp; 0 &amp; 1 \\\<br /> 0 &amp; 1 &amp; 0 \\\<br /> 1 &amp; 0 &amp; 0 \end{array} \right]\]

For a counter clockwise rotation:

\medspace B = \[ \left[ \begin{array}{ccc}<br /> 0 &amp; 0 &amp; 1 \\\<br /> 0 &amp; 1 &amp; 0 \\\<br /> 1 &amp; 0 &amp; 0 \end{array} \right]A^{T}

You can extend this to higher dimensions.

For a 5x5x5 array, you could define 3 axis of rotation i,j,k. A rotation around a line through the center of the array and parallel to the k-axis would need a rotation for each of the five layers of 5x5 matricies ( k = 1,2,...,5 ). Similarily for the rotations around the lines through the center and parallel to the i and j axies.
 
##\textbf{Exercise 10}:## I came across the following solution online: Questions: 1. When the author states in "that ring (not sure if he is referring to ##R## or ##R/\mathfrak{p}##, but I am guessing the later) ##x_n x_{n+1}=0## for all odd $n$ and ##x_{n+1}## is invertible, so that ##x_n=0##" 2. How does ##x_nx_{n+1}=0## implies that ##x_{n+1}## is invertible and ##x_n=0##. I mean if the quotient ring ##R/\mathfrak{p}## is an integral domain, and ##x_{n+1}## is invertible then...
The following are taken from the two sources, 1) from this online page and the book An Introduction to Module Theory by: Ibrahim Assem, Flavio U. Coelho. In the Abelian Categories chapter in the module theory text on page 157, right after presenting IV.2.21 Definition, the authors states "Image and coimage may or may not exist, but if they do, then they are unique up to isomorphism (because so are kernels and cokernels). Also in the reference url page above, the authors present two...
When decomposing a representation ##\rho## of a finite group ##G## into irreducible representations, we can find the number of times the representation contains a particular irrep ##\rho_0## through the character inner product $$ \langle \chi, \chi_0\rangle = \frac{1}{|G|} \sum_{g\in G} \chi(g) \chi_0(g)^*$$ where ##\chi## and ##\chi_0## are the characters of ##\rho## and ##\rho_0##, respectively. Since all group elements in the same conjugacy class have the same characters, this may be...
Back
Top