On 7/10/05 3:08 pm, "julian weaver" <[EMAIL PROTECTED]> wrote:
> I'm getting inconsistent integer values returned whilst rotating a ipix
> exported 3d sphere using .rotate(0, somevalue, 0)
> 
> This is problematic as I'm using the rotation vector to calculate the
> current rotation position in degrees.
> 
>    a_|_b
>    c | d
> 
> a = vector (0, x, 0)         --// evaluated by:  a[3] = 0 AND a[2] > 0
> b = vector (0, -x, 0)        --// and so on.
> c = vector (180, x, 180)
> d = vector (180, -x, 180)
> 
> The problem is that x flip flops between the above values and the
> inverse:
> 
> a = vector (0, -x, 0)
> b = vector (0, x, 0)
> c = vector (180, -x, 180)
> d = vector (180, x, 180)
> 
> Is there a way to force the rotation to keep to one of these?
> ( pointAt doesn't seem to make any difference )

Hi Julian,

Rotation around the y-axis leads to this sort of confusion.  It's a fact of
life, due (I am told) to the fact that the rotation is calculated by matrix
mathematics, not by quaternions, in order to improve performance.  Rotations
around the other axes do not cause such problems.

The reason is that you can arrive at the same position using more than one
set of rotations: a rotation of (0, 180, 0) gives you the same result as a
rotation of (180, 0, 180).  If you place a photagraph face up on a table,
then flip it lengthwise (face down) then widthwise (face up), you get the
same result as if you had twisted it round on the table-top for someone
sitting opposite you to look at it.

Are you rotating around the other axes at all?  If not, you check whether
the x- and z-coordinates are 180, and compensate when calculating y.  If you
are rotating around the other axes, then their values may not be exactly
equal to 0 or 180, and you need to do a few more calculations to "simplify"
the rotation in terms of the y-axis.

Does this help?

James 

 

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to