Public Member Functions
Kinematics Class Reference

Detailed Description

The Kinematics object represents the kinematics property of an X3DObject object.

See also:
X3DObject::GetKinematics
Example:
Illustrates how to convert a position from local coordinates to global coordinates.
        using namespace XSI;
        Application app;
        Model root = app.GetActiveSceneRoot();

        Model myModel;
        CRefArray emptyModel;
        root.AddModel( emptyModel, L"MyModel", myModel );
        myModel.GetParameter(L"posx").PutValue( (double)5.0 );

        Null myNull;
        myModel.AddNull( L"", myNull );
        myNull.GetParameter(L"posx").PutValue( (double)5.0 );

        // get local position
        MATH::CVector3 v3Pos( myNull.GetParameterValue(L"posx"),
                            myNull.GetParameterValue(L"posy"),
                            myNull.GetParameterValue(L"posz") );

        app.LogMessage( L"Local position = " +
                        CValue(v3Pos.GetX()).GetAsText() + L", " +
                        CValue(v3Pos.GetY()).GetAsText() + L", " +
                        CValue(v3Pos.GetZ()).GetAsText() );

        // transform local to global position
        MATH::CVector3 v3GlobalPos = MATH::MapObjectPositionToObjectSpace(
            myNull.GetKinematics().GetGlobal().GetTransform(),
            myNull.GetKinematics().GetLocal().GetTransform(),
            v3Pos );

        app.LogMessage( L"Global position = " +
                        CValue(v3GlobalPos.GetX()).GetAsText() + L", " +
                        CValue(v3GlobalPos.GetY()).GetAsText() + L", " +
                        CValue(v3GlobalPos.GetZ()).GetAsText() );

#include <xsi_kinematics.h>

Inheritance diagram for Kinematics:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Kinematics ()
 ~Kinematics ()
 Kinematics (const CRef &in_ref)
 Kinematics (const Kinematics &in_obj)
bool IsA (siClassID in_ClassID) const
siClassID GetClassID () const
Kinematicsoperator= (const Kinematics &in_obj)
Kinematicsoperator= (const CRef &in_ref)
CRefArray GetConstraints () const
CStatus AddConstraint (const CString &in_preset, const CRefArray &in_cnsning, bool in_bComp, const MATH::CVector3 &in_offsetCnsned, const MATH::CVector3 &in_offsetCnsning, Constraint &out_constraint)
KinematicState GetLocal () const
KinematicState GetGlobal () const

Constructor & Destructor Documentation

Default constructor.

~Kinematics ( )

Default destructor.

Kinematics ( const CRef in_ref)

Constructor.

Parameters:
in_refconstant reference object.
Kinematics ( const Kinematics in_obj)

Copy constructor.

Parameters:
in_objconstant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassIDclass type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from Property.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from Property.

Kinematics& operator= ( const Kinematics in_obj)

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_objconstant class object.
Returns:
The new Kinematics object.
Kinematics& operator= ( const CRef in_ref)

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_refconstant class object.
Returns:
The new Kinematics object.

Reimplemented from Property.

CRefArray GetConstraints ( ) const

Returns an array of Constraint objects that are constraining the parent of this object.

Returns:
Array of Constraint objects.
CStatus AddConstraint ( const CString in_preset,
const CRefArray in_cnsning,
bool  in_bComp,
const MATH::CVector3 in_offsetCnsned,
const MATH::CVector3 in_offsetCnsning,
Constraint out_constraint 
)

Applies a constraint to this object's parent.

Parameters:
in_presetThe type of constraint to add.
in_cnsningAn array of X3DObject references that will act as constrainers.
in_bCompCompensation mode, true to turn compensation on.
in_offsetCnsnedOptional offset which is applied in translation on the constrained object. The offset is used for Distance and Position constraints.
in_offsetCnsningOptional offset applied on the constraining object for Distance, Position, Surface and Trajectory constraints. The offset will be applied in rotation for the Orientation constraint, in translation for the Direction constraint and in scaling for the Scaling constraint.
Return values:
out_constraintNew constraint object
Returns:
CStatus::OK success
CStatus::InvalidArgument Preset or constraining objects are invalid.
CStatus::Fail failure
KinematicState GetLocal ( ) const

Returns a KinematicState object containing the local transformation of the X3DObject object (that is, the transformation relative to the parent).

Returns:
The KinematicState object.
See also:
X3DObject::GetLocalTranslation, X3DObject::GetLocalScaling, X3DObject::GetLocalRotation, X3DObject::PutLocalTranslation, X3DObject::PutLocalScaling, X3DObject::PutLocalRotation
KinematicState GetGlobal ( ) const

Returns a KinematicState object containing the global transformation of the X3DObject object (that is, the transformation relative to the parent).

Returns:
The KinematicState object.

The documentation for this class was generated from the following file: