Hi

I've run into a problem with some of the built-in quaternion routines in 
RB2007r2.  These seem to be newly-introduced as they have been working 
perfectly up until now and there are no changes mentioned in the release notes. 
 The quaternion properties are not calculated with the SetRotateAboutAxis 
method when you pass it your axis of rotation and the rotation angle - they are 
left at the default values of 1,0,0,0 for W,X,Y,Z.  If you calculate the 
quaternion properties yourself, set them and then call the Transform method to 
rotate a point say - then that doesn't work either.  If I go back to RB2007r1 
then it works fine either way (using SetRotateAboutAxis or calculating them 
myself) and then calling the Transform method.

I have only run into this on MacOSX (10.4.9 on a pre-Intel iMac G5).  The same 
code is working fine on WinXP.

Anyone have a clue about this?  I can work round it with rotation matrices but 
I prefer the cool, built-in quaternions and I guess they're a good bit faster.  
I'm puzzled also how maths routines like this could have died.  Below is an 
example that should rotate a point (1,0,0) through 120 degrees about an axis 
(1,1,1) - each of the quaternion properties in this case should be equal to 0.5 
and the point should be rotated round to the Y-axis, so it ends up at (0,1,0).

Many thanks for any help - Richard.


Dim q as New Quaternion
Dim RotationAxis as New Vector3D
Dim TestPoint as New Vector3D
Dim RotationAngle as Double

RotationAxis.X = 1.0
RotationAxis.Y = 1.0
RotationAxis.Z = 1.0

RotationAngle = 0.666667*3.1415927    // 120 degrees

TestPoint.X = 1.0
TestPoint.Y = 0.0
TestPoint.Z = 0.0

q.SetRotateAboutAxis(RotationAxis.X, RotationAxis.Y, RotationAxis.Z, 
RotationAngle)

TestPoint = q.Transform(TestPoint)

MsgBox "q.W = "+Format(q.W,"-#.0000")+Chr(13)+"q.X = 
"+Format(q.X,"-#.0000")+Chr(13)_
+"q.Y = "+Format(q.Y,"-#.0000")+Chr(13)+"q.Z = "+Format(q.Z,"-#.0000")+Chr(13)_
+"Test.X = "+Format(TestPoint.X,"-#.0000")+Chr(13)+"Test.Y = 
"+Format(TestPoint.Y,"-#.0000")+Chr(13)_
+"Test.Z = "+Format(TestPoint.Z,"-#.0000")

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to