I have the following lines of code in my program:

System.out.println("X: "+hx+" Y: "+hy+" Z: "+hz);
      v = new Quat4d(hx, hy, hz, 0.0);
System.out.println("i: "+i+" v: "+v);

which prints out:

X: 3.0 Y: 0.0 Z: 15.0
i: 0 v: (0.19611613513818402, 0.0, 0.9805806756909201, 0.0)

Why is the quaternion new Quat4d(hx, hy, hz, 0.0) being normalized?  I
didn't ask to have the quaternion normalized.  It should have printed:

X: 3.0 Y: 0.0 Z: 15.0
i: 0 v: (3.0, 0.0, 15.0, 0.0)

This also happens with Quat4f(hx, hy, hz, 0.0f).

Is this a known bug?

Now, everywhere I use a quaternion, I have to put something like:

System.out.println("X: "+hx+" Y: "+hy+" Z: "+hz);
      double length = Math.sqrt(hx*hx + hy*hy + hz*hz);
      v = new Quat4d(hx, hy, hz, 0.0);
      v.normalize();    // So I *know* I have a normalized quaternion
      v.scale(length);  // even though I don't want one.
System.out.println("i: "+i+" v: "+v);

to get the quaternion's components to have the correct values.

X: 3.0 Y: 0.0 Z: 15.0
i: 0 v: (3.000000000000001, 0.0, 15.000000000000004, 0.0)

What a pain.

Bob Gray

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to