- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to port some code from the AutoCAD API to a more generic .Net API and I found a discrepancy between two functions that are supposed to do the same thing.
In AutoCAD, I created an AutoCAD.Geometry.Matrix3d object and then rotated it about the Z Axis by AnglePhi (PI/8). Here's the code snippet.
Dim RotationMatrixZAxis As Autodesk.AutoCAD.Geometry.Matrix3d
RotationMatrixZAxis = Autodesk.AutoCAD.Geometry.Matrix3d.Rotation(AnglePhi, New Autodesk.AutoCAD.Geometry.Vector3d(0, 0, 1), New Autodesk.AutoCAD.Geometry.Point3d(0, 0, 0))
The resultant element values from this operation are: 1,1 = 0.9238, 1,2 = -0.3826, 1,3 = 0, 2,1 = 0.3826, 2,2 = 0.9238, 2,3 = 0, 3,1 = 0, 3,2 = 0, 3,3 = 1
Now I do the same thing using the System.Windows.Media.Media3D library.
Dim RotationMatrixZAxis As New System.Windows.Media.Media3D.Matrix3D
Dim MyQuaternion As New System.Windows.Media.Media3D.Quaternion(New Vector3D(0, 0, 1), AnglePhi * 180 / PI)
RotationMatrixYAxis.RotateAt(MyQuaternion, New Point3D(0, 0, 0))
The resultant element values from this operation are: 1,1 = 0.9238, 1,2 = 0.3826, 1,3 = 0, 2,1 = -0.3826, 2,2 = 0.9238, 2,3 = 0, 3,1 = 0, 3,2 = 0, 3,3 = 1
Notice that the rotation matrix using the System.Windows.Media.Media3D library is the inverse of the rotation matrix using Autodesk.AutoCAD.Geometry
Can anyone explain to me why this is? My code porting project is stopped dead in its tracks until I get this little mystery solved.
Thanks in advance!
Darren Haverstick
Paul Mueller Company
Solved! Go to Solution.