XSIMath.MapObjectPoseToObjectSpace
 
 
 

XSIMath.MapObjectPoseToObjectSpace

Description

Converts a pose described in an ObjectSpace to a pose in a different ObjectSpace.

C# Syntax

SITransformation XSIMath.MapObjectPoseToObjectSpace( SITransformation in_pObjectSpace, SITransformation in_pSpace, SITransformation in_pPose );

Scripting Syntax

oReturn = XSIMath.MapObjectPoseToObjectSpace( ObjectSpace, Space, Pose );

Return Value

SITransformation (pose)

Parameters

Parameter Type Description
ObjectSpace SITransformation ObjectSpace in which the pose is described.
Space SITransformation Space in which we want to convert the pose .
Pose SITransformation Pose to convert.

Examples

1. JScript Example

var oRoot = Application.ActiveProject.ActiveScene.Root;
var oCube = oRoot.AddGeometry("Cube","MeshSurface");
oCube.Kinematics.Global.Parameters("posy").value = 4.0;
oCube.Kinematics.Global.Parameters("posx").value = 2.0;
var oCube2 = oCube.AddGeometry("Cube","MeshSurface");
oCube2.Kinematics.Global.Parameters("posz").value = 3.0;
oCube2.Kinematics.Global.Parameters("rotx").value = 45.0;
var oCone = oRoot.AddGeometry("Cone", "MeshSurface");
oCone.Kinematics.Global.Parameters("posy").value = -2.0;
oCone.Kinematics.Global.Parameters("posz").value = 90.0;
var oTrans = oCube.Kinematics.Local.Transform;
var oTransParent = oCube2.Kinematics.Global.Transform;
var oVec3 = XSIMath.CreateVector3();
oTrans.GetTranslation (oVec3);
var oDestinationTrans = oCone.Kinematics.Global.Transform;
LogMessage ( "The translation of the cube relative to its parent: x " +
oVec3.x + " y " + oVec3.y + " z " + oVec3.z );
var oObjectTrans = XSIMath.MapObjectPoseToObjectSpace(oTransParent, oDestinationTrans, oTrans);
oObjectTrans.GetTranslation(oVec3);
LogMessage ( "The translation of the cube relative to the cone: x " +
oVec3.x + " y " + oVec3.y + " z " + oVec3.z );
// Expected results:
//INFO : The translation of the cube relative to its parent: x 2 y 4 z 0
//INFO : The translation of the cube relative to the cone: 
//                      x 2 y 4.82842712474619 z -84.1715728752538

2. VBScript Example

set oRoot = Application.ActiveProject.ActiveScene.Root
set oCube = oRoot.AddGeometry("Cube","MeshSurface")
oCube.Kinematics.Global.Parameters("posy").value = 4.0
oCube.Kinematics.Global.Parameters("posx").value = 2.0
set oCube2 = oCube.AddGeometry("Cube","MeshSurface")
oCube2.Kinematics.Global.Parameters("posz").value = 3.0
oCube2.Kinematics.Global.Parameters("rotx").value = 45.0
set oCone = oRoot.AddGeometry("Cone", "MeshSurface")
oCone.Kinematics.Global.Parameters("posy").value = -2.0
oCone.Kinematics.Global.Parameters("posz").value = 90.0
set oTrans = oCube2.Kinematics.Local.Transform
set oTransParent = oCube2.Kinematics.Global.Transform
set oVec3 = XSIMath.CreateVector3
oTrans.GetTranslation oVec3
set oDestinationTrans = oCone.Kinematics.Global.Transform
Application.LogMessage "The translation of the cube relative to its parent: x " &_
                         oVec3.x & " y " & oVec3.y & " z " & oVec3.z
set oObjectTrans = XSIMath.MapObjectPoseToObjectSpace(oTransParent, oDestinationTrans,oTrans)
oObjectTrans.GetTranslation oVec3
Application.LogMessage "The translation of the cube relative to the cone: x " &_
                         oVec3.x & " y " & oVec3.y & " z " & oVec3.z
' Expected results:
'INFO : The translation of the cube relative to its parent: x 2 y 4 z 0
'INFO : The translation of the cube relative to the cone: x 2 y 4.82842712474619 z -84.1715728752538