|
DigiPara Liftdesigner LDX API
|
API method: ILDXHideCS5.SetXy
' from Samples/Src/LDXAPIExamples/Example_LDXHideCS.vb
<APIHelpAttribute(APIHelpModes.None, {APIHelpModes.InputParaLDXApp}, "", "LDXHideCS~SetXy", "Using Matrices")>
Public Shared Sub UseMatrix(ByRef ldxApplication As DigiPara.LDX.LDXApplication)
Dim ldxFactory = ldxApplication.Factory
' set matrix to 90 degree rotation around z axis and a translation by 3 along the z axis
Dim ldxMatrixA = ldxFactory.CreateMatrix(Nothing)
ldxMatrixA.SetXy(0, 1, 0, -1, 0, 0)
ldxMatrixA.R.Z = 3
System.Diagnostics.Debug.Assert(ldxMatrixA.R.Z = 3)
System.Diagnostics.Debug.Assert(ldxMatrixA.X.Y = 1)
System.Diagnostics.Debug.Assert(ldxMatrixA.Y.X = -1)
' set matrix to 180 degree rotation around z axis and a translation by 1 along the x axis
Dim ldxMatrixB = ldxFactory.CreateMatrix(Nothing)
ldxMatrixB.SetXy(-1, 0, 0, 0, -1, 0)
ldxMatrixB.R.X = 1
System.Diagnostics.Debug.Assert(ldxMatrixB.R.X = 1)
System.Diagnostics.Debug.Assert(ldxMatrixB.X.X = -1)
System.Diagnostics.Debug.Assert(ldxMatrixB.Y.Y = -1)
' three ways to concatenate them as ldxMatrixB * ldxMatrixA
Dim ldxMatrixC1 = ldxFactory.CreateMatrix(ldxMatrixA)
ldxMatrixC1.PostMultiplyWith(ldxMatrixB)
Dim ldxMatrixC2 = ldxFactory.CreateMatrix(ldxMatrixB)
ldxMatrixC2.PreMultiplyWith(ldxMatrixA)
Dim ldxMatrixC3 = ldxFactory.CreateMatrix(Nothing)
ldxMatrixC3.SetToChain(ldxMatrixB, ldxMatrixA)
AssertMatrixSame(ldxMatrixC2, ldxMatrixC1)
AssertMatrixSame(ldxMatrixC3, ldxMatrixC1)
System.Diagnostics.Debug.Assert(ldxMatrixC1.R.Z = 3)
System.Diagnostics.Debug.Assert(ldxMatrixC1.R.X = 1)
System.Diagnostics.Debug.Assert(ldxMatrixC1.X.Y = -1)
System.Diagnostics.Debug.Assert(ldxMatrixC1.Y.X = 1)
End Sub