Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Fixed Point Values Decreasing

Status
Not open for further replies.

vjabagch

Member level 1
Joined
Jun 26, 2009
Messages
35
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,665
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.

Please advise.
 

Sounds like you've got a truncation/rounding problem. I would look carefully at your math; you may be losing something in your transform.
 

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.

I will try to inspect further and report back.
 

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.

https://www.edaboard.com/threads/39599/
 

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.

Would this method be more accurate?
 

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.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top