DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Euler Anlges

API method: ILDXHideCS5.SetRollPitchYawRad

 ' from Samples/Src/LDXAPIExamples/Example_LDXHideCS.vb

    <APIHelpAttribute(APIHelpModes.None, {APIHelpModes.InputParaLDXApp}, "", "LDXHideCS~SetRollPitchYawRad", "Euler Anlges")>
 Public Shared Sub EulerAngles(ByRef ldxApplication As DigiPara.LDX.LDXApplication)
     Dim ldxFactory = ldxApplication.Factory

     ' set matrix to 90 degree rotation around z axis
     Dim ldxMatrixA = ldxFactory.CreateMatrix(Nothing)
     ldxMatrixA.SetXy(0, 1, 0, -1, 0, 0)

     ' get euler angles; it should be just a yaw of 90 degrees
     Dim eulerAnglesA = ldxMatrixA.GetRollPitchYawRad()
     System.Diagnostics.Debug.Assert(Math.Abs(eulerAnglesA.X) < 0.01)
     System.Diagnostics.Debug.Assert(Math.Abs(eulerAnglesA.Y) < 0.01)
     System.Diagnostics.Debug.Assert(Math.Abs(eulerAnglesA.Z - Math.PI / 2) < 0.01)

     ' set matrix to 90 degree pitch up (rotation around y)
     Dim ldxMatrixB = ldxFactory.CreateMatrix(Nothing)
     Dim eulerAnglesB = ldxFactory.CreateVector(Nothing)
     eulerAnglesB.Y = -Math.PI / 2
     ldxMatrixB.SetRollPitchYawRad(eulerAnglesB)
     System.Diagnostics.Debug.Assert(Math.Abs(ldxMatrixB.X.X) < 0.01)
     System.Diagnostics.Debug.Assert(Math.Abs(ldxMatrixB.X.Z - 1) < 0.01)
     System.Diagnostics.Debug.Assert(Math.Abs(ldxMatrixB.Y.Y - 1) < 0.01)

     ' the euler angle values model an aeroplane with its nose pointing along the X axis in its local coordinate system, flying in a global coordinate system where Z Is up.
     ' A different way to think about it Is that Yaw gives the direction of the local X axis in the global X/Y plane, Pitch gives the angle between the local X axis And the global X/Y plane. 
     ' Or, Yaw And Pitch correspond to longitude And latitude in spherical coordinates, describing the direction of the local X axis.
     ' Roll Is the rotation around the local X axis to complete the picture.
     ' Of course, these angles have anomalies around Pitch close to its extreme values. For Pitch close to +PI/2, only the sum of Yaw And Roll matters; for Pitch close to -PI/2, only their difference.

 End Sub