3D rotating using whole number increments.

96 Views Asked by At

I am working on some 3D rotation calculations but have some unusual limitations.

  1. I have to move the coordinates relative to the current coordinates ex:

new = [x,y,z] current = [x1,y1,z1] move(new[0] - current[0], new[1] - current[1]) (This moves the vertex from its current position to the new position).

  1. The other limitation I have is, I can only move the position by whole numbers.

Ignoring the second limitation, I am able to rotate the object. However, the object gets stretched and compressed throughout the rotation process. (I am guessing this odd stretching is due to the second limitation)

My question is, would there be a way to remove the stretching and compression from my rotation with the limitations in place?

2

There are 2 best solutions below

0
On BEST ANSWER

If the warping is due to roundoff, you cannot eliminate it, but you can prevent it from compounding between additional rotations, by storing the original shape and the rotations that led to the new shape, and applying them to the floating point points, and only rounding at the final step. In this way, you will not accumulate error due to the round-rotate-round cycle.

0
On

You can reduce it by using larger whole numbers. If you multiply all the coordinates by a million, say, the fractional stretching becomes much smaller. You are just measuring distances in mm instead of km.