Class Link

3DS Max Plug-In SDK

Class Link

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

class Link

Description:

This class is available in release 4.0 and later only.

This class represents a single link in the link chain. A Link is a single degree of freedom rotation followed by a rigidExtend. The DOF axis is specified by dofAxis. It is always active.

Data Members:

public:

DofAxis dofAxis;

The variable part of a Link is of one degree of freedom. It can be translational or rotational. One of the following; TransX, TransY, TransZ, RotX, RotY, or RotZ.

float dofValue;

The current value with regard to the degree of freedom.

float initValue;

The initial value.

Point2 limits;

The constrained lower and upper limits. [0] for the lower limit and [1] for the upper limit.

private:

Matrix3 rigidExtend;

The rigid extents.

byte llimited : 1;

Lower limit flag.

byte ulimited : 1;

Upper limit flag.

Methods:

public:

Prototype:

Link():rigidExtend(0),dofAxis(RotZ);

Remarks:

Constructor.

Default Implementation:

{ }

Prototype:

~Link();

Remarks:

Destructor.

Default Implementation:

{ if (rigidExtend) delete rigidExtend; rigidExtend = 0; }

Prototype:

bool NullLink() const;

Remarks:

This method checks whether the link is a null-link. When TRUE, the rigid extend is logically an identity matrix.

Default Implementation:

{ return rigidExtend?false:true; }

Prototype:

bool ZeroLength();

Remarks:

This method checks whether the link has no length. When TRUE, it is a pure rotation matrix.

Prototype:

bool LLimited() const;

Remarks:

This method checks whether the degree of freedom is further constrained by lower limits. TRUE if constrained, otherwise FALSE.

Default Implementation:

{ return llimited?true:false; }

Prototype:

bool ULimited() const;

Remarks:

This method checks whether the degree of freedom is further constrained by upper limits. TRUE if constrained, otherwise FALSE.

Default Implementation:

{ return ulimited?true:false; }

Prototype:

Matrix3 DofMatrix() const;

Remarks:

This mehod returns the matrix contribution by the degrees of freedom. Either it is a pure rotation or a pure translation, of one axis. The following identity holds;

LinkMatrix(true) ยบ LinkMatrix(false) * DofMatrix()

Prototype:

Matrix3& DofMatrix(Matrix3& mat) const;

Remarks:

This method allows you to apply a matrix, mat, by the DofMatrix() so that mat = mat * DofMatrix().

Parameters:

Matrix3& mat

The matrix to multiply by the DOF matrix.

Return Value:

A reference to the matrix argument.

Prototype:

Matrix3 LinkMatrix(bool include_dof = true) const;

Remarks:

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

Parameters:

bool include_dof = true

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_dof = true) const;

Remarks:

This methods applies the LinkMatrix() to the input matrix.

Parameters:

Matrix3& mat

The input matrix.

bool include_dof = true

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.

Prototype:

void SetLLimited(bool s) const;

Remarks:

This method allows you to activate or deactivate the lower limits.

Parameters:

bool s

TRUE to activate, FALSE to deactivate.

Prototype:

void SetULimited(bool s) const;

Remarks:

This method allows you to activate or deactivate the upper limits.

Parameters:

bool s

TRUE to activate, FALSE to deactivate.

Prototype:

void SetRigidExtend(const Matrix3& mat);

Remarks:

This method allows you to set the RigidEtend matrix.

Parameters:

const Matrix3& mat

The rigid extend matrix you wish to set.