XSIMath.MapObjectPoseToObjectSpace

XSIMath.MapObjectPoseToObjectSpace

説明

ある ObjectSpace で記述されているポーズを、異なる ObjectSpace でのポーズに変換します。

C#構文

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

スクリプト構文

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

戻り値

SITransformation(ポーズ)

パラメータ

パラメータ タイプ 説明
ObjectSpace SITransformation ポーズが記述されている ObjectSpace
Space SITransformation ポーズを変換する先の ObjectSpace
Pose SITransformation 変換するポーズ

1. JScript の例

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 の例

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