MapObjectOrientationToObjectSpace (XSIMath)

Description

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

Scripting Syntax

XSIMath.MapObjectOrientationToObjectSpace( ObjectSpace, Space, Orientation )

C# Syntax

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

Parameters

Parameter

Type

Description

ObjectSpace

SITransformation

ObjectSpace in which the orientation is described.

Space

SITransformation

Space in which we want to convert the orientation.

Orientation

SIVector3

Orientation to convert.

Return Value

SIVector3 (orientation)

Examples

1. JScript Example

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 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 = 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"


Autodesk Softimage v7.5