Class RootLink

3DS Max Plug-In SDK

Class RootLink

See Also: Class LinkChain, Class Link, Class Matrix3, Class Point3, Inverse Kinematics

class RootLink

Description:

This class is available in release 4.0 and later only.

A RootLink consists of a rotation plus a rigidExtend. It transforms like this:

To_Coordinate_Frame = rigidExtend * rotXYZ * From_Coordinate_Frame

where rotXYZ = Rot_x(rotXYZ[0]) * Rot_y(rotXYZ[1]) * Rot_z(rotXYZ[2]).

Note that not all the x, y, and z, are degrees of freedom. Only Active() ones are. We put the whole rotation here so that some solver may choose to use it as a full rotation and then clamp the result to the permissible range.

Data Members:

public:

Point3 rotXYZ;

The xyz rotation.

Point3 initXYZ;

Corresponds to the PrefRotation() of the Start Joint.

Point3 llimits;

The lower limits.

Point3 ulimits;

The upper limits.

Matrix3 rigidExtend;

The rigid extents.

private:

unsigned flags;

The root link flags.

Methods:

public:

Prototype:

RootLink():flags(7)

Remarks:

Constructor.

Default Implementation:

{ }

Prototype:

bool GetActive(unsigned i) const;

Remarks:

This method informs the Solver whether a particular component is active.

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

Return Value:

TRUE if the specified component is active, otherwise FALSE.

Default Implementation:

{ return flags&(1<<i)?true:false; }

Prototype:

void SetActive(unsigned i, bool s);

Remarks:

This method allows you to activate or deactivate a particular component.

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

bool s

TRUE to activate, FALSE to deactivate.

Prototype:

bool GetLLimited(unsigned i) const;

Remarks:

This method informs the Solver whether a particular component has its lower limits active.

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

Return Value:

TRUE if the specified component is active, otherwise FALSE.

Default Implementation:

{ return flags&(1<<(i+3))?true:false; }

Prototype:

bool SetLLimited(unsigned i, bool s) const;

Remarks:

This method allows you to activate or deactivate a particular component’s lower limits.

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

bool s

TRUE to activate, FALSE to deactivate.

Prototype:

bool GetULimited(unsigned i) const;

Remarks:

This method informs the Solver whether a particular component has its upper limits active.

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

Return Value:

TRUE if the specified component is active, otherwise FALSE.

Default Implementation:

{ return flags&(1<<(i+6))?true:false; }

Prototype:

bool SetULimited(unsigned i, bool s) const;

Remarks:

This method allows you to activate or deactivate a particular component’s upper limits.

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

bool s

TRUE to activate, FALSE to deactivate.

Prototype:

Matrix3& RotateByAxis(Matrix3& mat, unsigned i) const;

Remarks:

This method will pre-apply the rotation about the x, y, or z axis. Therefore, starting with the identity matrix mat,

ApplyLinkMatrix(

RotateByAxis(

RotateByAxis(

RotateByAxis(mat, 2),

1),

0),

false)

should equal to LinkMatrix(true).

Parameters:

unsigned i

The component, 0 through 3 for x, y, and z, respectively.

Prototype:

Matrix3 LinkMatrix(bool include_rot) const;

Remarks:

This method returns the link matrix just defined if the argument is TRUE.

Parameters:

bool include_rot

TRUE to return the link matrix, FALSE to return RigidExtend.

Return Value:

The link matrix, otherwise it simply returns RigidExtend.

Prototype:

Matrix3& ApplyLinkMatrix(Matrix3& mat, bool include_rot) const;

Remarks:

This methods applies the LinkMatrix() to the input matrix, or mat = mat * LinkMatrix(include_rot)

Parameters:

Matrix3& mat

The input matrix.

bool include_rot

When applying the DOF part, or rotation part, to a matrix, this will take place one at a time by calling RootLink::RotateByAxis(). If you want to apply the whole link, while already having applied the rotation part, you would need to set this flag to FALSE.

Return Value:

The reference to the input matrix, mat.