I have a design that renders fixed point coordinates of a 3D object on a monitor. The design is implemented on an FPGA and outputs the signal to the monitor. I am applying 3D rotation transformations across X, Y, and Z axes. When applying the transformation the object keeps mutating and shrinking until it approaches zero for all coordinates. The object rotates about its center.
I have tried using a fixed-point rounding scheme in combination with a multiplication by a correction factor (distance to center of original dataset divided by the distance to the center after rotation).
Even with both methods being used my object keeps shrinking.
Is there any way I can preserve the rigid body distances of each coordinate using fixed point precision for my design without shrinking the object at each rotation increment.
I was thinking that perhaps my limited precision is causing the error. I use 14bits (sign bit included) for x, y, z. Monitor resolution is at 512 X 512.
The correction factor which I multiply by the rotated coordinate is very close to 1 which is making me think that I don't really offset the shrinking values.
Not strictly related to the problem, but an interesting example how an asymmetrical 2D rotation algorithm can maintain an infinite sequence with rather coarse integer arithmetics. Please review particularly the discussion "why it works?".
I guess, the principle can be applied to 3D as well.
Just out of curiosity, could my original method of correcting the mutation be incorrect? I was originally finding a 3D distance to center. When I rotate incrementally I only work with 2 axes at a time. Therefore the third axis coordinate remains unchanged. So my new method is to find the 2D distance to the center for XY, YZ, and XZ. Then depending on the axis of rotation I correct based on the 2D distance.
Why don't you keep track of the total rotation from the original position?
If you do every rotation from the original position the problem should go away, and the amount of computation is unchanged.
Why don't you keep track of the total rotation from the original position?
If you do every rotation from the original position the problem should go away, and the amount of computation is unchanged.
Thank you for the help. I have been comparing to the original distance (2D) but I think I might be capturing the wrong bits on my correction factor. I keep 3 separated look up tables. The look up tables are XY, XZ And YZ distances in 2D. Now I might be faced with some timing or synchronization issue. I will keep inspecting and post back if I get the desired output.
I realized that since I rotate in 3D i keep two buffers (read and write). 3D rotation is not commutative and therefore I store every incremental rotation result in the dual buffer memory.