XSIMath.MapObjectOrientationToObjectSpace

説明

ObjectSpace で記述された方向を、異なる ObjectSpace の方向に変換します。

C#構文

SIVector3 XSIMath.MapObjectOrientationToObjectSpace( SITransformation in_pObjectSpace, SITransformation in_pSpace, SIVector3 in_pOrientation );

スクリプト構文

oReturn = XSIMath.MapObjectOrientationToObjectSpace( ObjectSpace, Space, Orientation );

戻り値

SIVector3(向き)

パラメータ

パラメータ タイプ 説明
ObjectSpace SITransformation 方向が記述されている ObjectSpace
Space SITransformation 方向を変換する先の ObjectSpace
Orientation SIVector3 変換する方向

1. JScript の例

var oRoot = Application.ActiveProject.ActiveScene.Root;

var oCube = oRoot.AddGeometry("Cube","MeshSurface");

oCube.Kinematics.local.Parameters("posy").value = 4.0;

oCube.Kinematics.local.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.global.Transform;

var oOri = XSIMath.CreateVector3();

aNormal = new VBArray( oCube.ActivePrimitive.Geometry.Facets.NormalArray );

oOri.x = aNormal.getItem(0,1);

oOri.y = aNormal.getItem(1,1);

oOri.z = aNormal.getItem(2,1);

var oDestinationTrans = oCone.Kinematics.Global.Transform;

var oObjectOri = XSIMath.MapObjectOrientationToObjectSpace(oTrans, oDestinationTrans, oOri);

Application.LogMessage  ("The second face of the cube normal vector represented in the cone referential " 

				+ XSIMath.RadiansToDegrees(oObjectOri.X) + "," + XSIMath.RadiansToDegrees(oObjectOri.Y) 

				+ "," + XSIMath.RadiansToDegrees(oObjectOri.Z) + " in the cube object space");

// Expected results:

//INFO : The second face of the cube normal vector represented in the cone referential 

//			0,-57.29577951308232,0 in the cube object space

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 = oCube.Kinematics.Local.Transform

set oOri = XSIMath.CreateVector3

aNormal = oCube.ActivePrimitive.Geometry.Facets.NormalArray

oOri.x = aNormal(0,1)

oOri.y = aNormal(1,1)

oOri.z = aNormal(2,1)

set oDestinationTrans = oCone.Kinematics.Global.Transform

set oObjectOri = XSIMath.MapObjectOrientationToObjectSpace(oTrans, oDestinationTrans, oOri)

Application.LogMessage  "The second face of the cube normal vector represented in the cone referential(" & _

				XSIMath.RadiansToDegrees(oObjectOri.X) & "," & _

				XSIMath.RadiansToDegrees(oObjectOri.Y) & "," & _

				XSIMath.RadiansToDegrees(oObjectOri.Z) & ") in the cube object space"