V-ART
Public Types | Public Member Functions | Protected Attributes | List of all members
VART::Joint Class Reference

Representation of joints. More...

#include <joint.h>

Inheritance diagram for VART::Joint:
VART::Transform VART::SceneNode VART::MemoryObj VART::BiaxialJoint VART::PolyaxialJoint VART::UniaxialJoint VART::CondylarJoint VART::EllipsoidJoint VART::SaddlelJoint VART::HingeJoint VART::PivotJoint

Public Types

enum  DofID { FLEXION, ADDUCTION, TWIST }
 
- Public Types inherited from VART::SceneNode
enum  TypeID {
  NONE, GRAPHIC_OBJ, BOX, CONE,
  CURVE, BEZIER, CYLINDER, IMAGE,
  IMAGE_2D, VOLUME, MESH_OBJECT, SPHERE,
  JOINT, BIAXIAL_JOINT, CONDYLAR_JOINT, ELLIPSOID_JOINT,
  SADDLE_JOINT, PLANE_JOINT, POLYAXIAL_JOINT, UNIAXIAL_JOINT,
  HINGE_JOINT, PIVOT_JOINT, TRANSFORM
}
 

Public Member Functions

 Joint ()
 Creates an uninitialized joint. More...
 
 Joint (const Joint &j)
 
virtual ~Joint ()
 
virtual VART::SceneNodeCopy ()
 Returns a copy of a Joint. Every derived class must reimplement this method, to avoid errors with VART::SceneNode::RecursiveCopy. More...
 
virtual void CopyDofListFrom (VART::Joint &joint)
 Copy the dofList atribute from an joint, setting the ownerJoint atribute of copied dof to 'this' joint instance. More...
 
const Jointoperator= (const Joint &j)
 
unsigned short int GetNumDofs () const
 
virtual DofAddDof (const Point4D &vec, const Point4D &pos, float min, float max)
 Adds a Dof. More...
 
virtual void AddDof (Dof *dof)
 Adds a Dof. More...
 
void MakeLim ()
 Updates the LIM, based on DOFs' situation. More...
 
const DofGetDof (DofID dof) const
 Returns a joint's DOF. More...
 
void GetDofs (std::list< Dof * > *dofListPtr)
 Returns all DOFs. More...
 
DofID GetDofID (const Dof *dofPtr) const
 Returns the DofID of some member Dof. More...
 
void SetAtRest ()
 Put the joint in a rest position. More...
 
bool MoveDof (DofID dof, float variance)
 Moves a joint's DOF. More...
 
bool HasDof (DofID dof)
 Checks whether a DOF exists in the joint. More...
 
virtual TypeID GetID ()
 Returns type identification of the node. More...
 
virtual void XmlPrintOn (std::ostream &os, unsigned int indent) const
 Outputs XML representation of the scene. More...
 
- Public Member Functions inherited from VART::Transform
 Transform ()
 Creates an uninitialized transform. More...
 
 Transform (const Transform &trans)
 Copy constructor. More...
 
void MakeIdentity ()
 Turns transform into identity. More...
 
Point4D operator* (const Point4D &point) const
 Applies transformation to a point. More...
 
Transform operator* (const Transform &t) const
 Applies transformation to another transform. More...
 
Transformoperator= (const Transform &t)
 Copies data from anoter transform. More...
 
void Apply (const Transform &t)
 Applies a transformation to itself. More...
 
void ApplyTo (Point4D *ptPoint) const
 Applies tranformation to a point. More...
 
void MakeTranslation (const Point4D &translationVector)
 Turns transform into a translation. More...
 
void MakeTranslation (double tx, double ty, double tz)
 Turns transform into a translation. More...
 
void MakeXRotation (double radians)
 Turns transform into a rotation around the X axis. More...
 
void MakeYRotation (double radians)
 Turns transform into a rotation around the Y axis. More...
 
void MakeZRotation (double radians)
 Turns transform into a rotation around the Z axis. More...
 
void MakeRotation (const Point4D &refVec, const float radians)
 Turns transform into a rotation (around some reference vetor). More...
 
void MakeRotation (const Point4D &refPoint, const Point4D &refVec, const float radians)
 Turns transform into a rotation (around some reference axis). More...
 
void MakeScale (double sX, double sY, double sZ)
 Turns transform into a scale. More...
 
void MakeShear (double shX, double shY)
 Turns transform into a shear. More...
 
void SetData (double *data)
 Set all data in the transform. More...
 
const double * GetData () const
 Returns the address of transformation matrix. More...
 
void GetVectorX (Point4D *result) const
 Returns the X vector of the transform. More...
 
void GetVectorY (Point4D *result) const
 Returns the Y vector of the transform. More...
 
void GetVectorZ (Point4D *result) const
 Returns the Z vector of the transform. More...
 
void GetTranslation (Point4D *result) const
 Returns the translation part of the transform. More...
 
bool HasNaN () const
 Check for NaNs inside the matrix. More...
 
virtual bool DrawOGL () const
 Apply transform to rendering engine. More...
 
virtual void DrawForPicking () const
 Draws and object, setting pick info. More...
 
virtual TypeID GetID () const
 Returns type identification of the node. More...
 
virtual bool RecursiveBoundingBox (BoundingBox *bBox)
 Returns the recursive bounding box. More...
 
void ToggleRecVisibility ()
 Toggles the recursive object's visibility. More...
 
void CopyMatrix (const Transform &t)
 Copies matrix data from another transform. More...
 
- Public Member Functions inherited from VART::SceneNode
 SceneNode ()
 Creates an uninitialized scene node. More...
 
 SceneNode (SceneNode &node)
 
virtual ~SceneNode ()
 
SceneNodeoperator= (const SceneNode &node)
 
virtual SceneNodeRecursiveCopy ()
 
const std::string & GetDescription () const
 Returns a copy of the object's description. More...
 
void SetDescription (const std::string &desc)
 Changes the object's description. More...
 
void AddChild (SceneNode &child)
 Add a child at the end of child list. More...
 
bool DetachChild (SceneNode *childPtr)
 Removes a child from the child list. More...
 
void AutoDeleteChildren () const
 Deletes (dealocate memory) recursively all children marked as 'autoDelete'. More...
 
SceneNodeFindChildByName (const std::string &name) const
 Recusively searches its children for a given name. More...
 
std::list< SceneNode * > GetChilds ()
 
bool FindPathTo (SceneNode *targetPtr, SGPath *resultPtr) const
 Search target among children. More...
 
bool FindPathTo (const std::string &targetName, SGPath *resultPtr) const
 Search target among children. More...
 
int GetNodeTypeList (TypeID type, std::list< SceneNode * > &nodeList)
 Find all the nodes of with typeID 'type'. More...
 
virtual void TraverseDepthFirst (SNOperator *operatorPtr) const
 Process all children in depth-first order. More...
 
virtual void TraverseBreadthFirst (SNOperator *operatorPtr) const
 Process all children in breadth-first order. More...
 
virtual void LocateDepthFirst (SNLocator *locatorPtr) const
 Seaches for a particular scene node (depth first) More...
 
virtual void LocateBreadthFirst (SNLocator *locatorPtr) const
 Seaches for a particular scene node (breadth first) More...
 
- Public Member Functions inherited from VART::MemoryObj
 MemoryObj ()
 Default constructor. More...
 
 MemoryObj (const VART::MemoryObj &obj)
 Copy constructor. More...
 

Protected Attributes

std::list< Dof * > dofList
 
- Protected Attributes inherited from VART::Transform
double matrix [16]
 
- Protected Attributes inherited from VART::SceneNode
std::list< SceneNode * > childList
 Child list. More...
 
std::string description
 Textual identification. More...
 

Additional Inherited Members

- Public Attributes inherited from VART::MemoryObj
bool autoDelete
 
- Static Public Attributes inherited from VART::SceneNode
static bool recursivePrinting = true
 
- Protected Member Functions inherited from VART::SceneNode
virtual bool DrawInstanceOGL () const
 Non-recursive drawing - should be overriden by every derived class. More...
 
bool RecursiveFindPathTo (SceneNode *targetPtr, SGPath *resultPtr) const
 Recursive auxiliar method for FindPathTo. More...
 
bool RecursiveFindPathTo (const std::string &targetName, SGPath *resultPtr) const
 Recursive auxiliar method for FindPathTo. More...
 

Detailed Description

Representation of joints.

A joint can be seen as a special kind of geometric transformation. It deals with the complexities of real articulations, producing geometric transformations that can be delivered to the graphics pipeline. A joint is a collecion of DOFs (see Dof) in which their order is important - the transformation of a joint is (... DOF3 * DOF2 * DOF1), that is, DOF1's transform, followed by DOF2's transform... In the current implementation, when DOFs change, their hierarchically inferior DOFs are transformed, that is, on a 3-DOF joint, changing the 2nd DOF tranforms the 3rd DOF. Their order is defined by AddDof method. On future implementations this should change to allow creation of more sophisticated joints. Joints may not share DOFs, see Dof for an explanation. Compile with symbol VISUAL_JOINTS if you want to see DOFs for debugging purposes.

Definition at line 34 of file joint.h.

Member Enumeration Documentation

Enumerator
FLEXION 
ADDUCTION 
TWIST 

Definition at line 36 of file joint.h.

Constructor & Destructor Documentation

VART::Joint::Joint ( )

Creates an uninitialized joint.

Definition at line 19 of file joint.cpp.

VART::Joint::Joint ( const Joint j)

Definition at line 23 of file joint.cpp.

VART::Joint::~Joint ( )
virtual

Definition at line 51 of file joint.cpp.

Member Function Documentation

VART::Dof * VART::Joint::AddDof ( const Point4D vec,
const Point4D pos,
float  min,
float  max 
)
virtual

Adds a Dof.

Parameters
vec[in] A vector. Together with "pos", defines the rotation axis of the new Dof.
pos[in] A point. Together with "vec", defines the roatation axis of the new Dof.
min[in] An angle (radians). Minimal allowed rotation.
max[in] An angle (radians). Maximal allowed rotation.
Returns
a pointer to the newly created Dof.

Creates a new Dof with given parameters. Attaches the Dof to itself. The memory will be released upon Joint destruction.

Reimplemented in VART::UniaxialJoint.

Definition at line 69 of file joint.cpp.

References VART::Dof::SetOwnerJoint().

Referenced by VART::PolyaxialJoint::AddDof(), and VART::BiaxialJoint::AddDof().

void VART::Joint::AddDof ( VART::Dof dof)
virtual

Adds a Dof.

Reimplemented in VART::BiaxialJoint, VART::UniaxialJoint, and VART::PolyaxialJoint.

Definition at line 77 of file joint.cpp.

References VART::Dof::SetOwnerJoint().

VART::SceneNode * VART::Joint::Copy ( )
virtual

Returns a copy of a Joint. Every derived class must reimplement this method, to avoid errors with VART::SceneNode::RecursiveCopy.

Reimplemented from VART::Transform.

Reimplemented in VART::UniaxialJoint, VART::PolyaxialJoint, and VART::BiaxialJoint.

Definition at line 28 of file joint.cpp.

References CopyDofListFrom().

void VART::Joint::CopyDofListFrom ( VART::Joint joint)
virtual

Copy the dofList atribute from an joint, setting the ownerJoint atribute of copied dof to 'this' joint instance.

Definition at line 37 of file joint.cpp.

References dofList, and VART::Dof::SetOwnerJoint().

Referenced by VART::BiaxialJoint::Copy(), VART::PolyaxialJoint::Copy(), VART::UniaxialJoint::Copy(), and Copy().

const VART::Dof & VART::Joint::GetDof ( DofID  dof) const

Returns a joint's DOF.

Returns a read-only version of a DOF from the joint. Requires the existence of given Dof. See DofID constants.

Definition at line 100 of file joint.cpp.

VART::Joint::DofID VART::Joint::GetDofID ( const Dof dofPtr) const

Returns the DofID of some member Dof.

Definition at line 127 of file joint.cpp.

Referenced by VART::JointMover::CopyFrom(), and VART::OffsetModifier::Modify().

void VART::Joint::GetDofs ( std::list< Dof * > *  dofListPtr)

Returns all DOFs.

Adds pointers to all DOFs to the given list.

Definition at line 113 of file joint.cpp.

Referenced by VART::IKChain::IKChain().

virtual TypeID VART::Joint::GetID ( )
inlinevirtual

Returns type identification of the node.

Definition at line 102 of file joint.h.

References VART::SceneNode::JOINT.

unsigned short int VART::Joint::GetNumDofs ( ) const
inline

Definition at line 51 of file joint.h.

References dofList.

bool VART::Joint::HasDof ( DofID  dof)

Checks whether a DOF exists in the joint.

Definition at line 167 of file joint.cpp.

void VART::Joint::MakeLim ( )

Updates the LIM, based on DOFs' situation.

Not of interest to the application programmer. This method is called by DOFs when they are updated in order to keep the joint updated as well.

Definition at line 83 of file joint.cpp.

bool VART::Joint::MoveDof ( DofID  dof,
float  variance 
)

Moves a joint's DOF.

Returns
True if the specified DOF exists.
Parameters
dof[in] Specifies which DOF should be modified.
variance[in] Specifies how much the DOF should move (using [0:1] position range).

Definition at line 148 of file joint.cpp.

const VART::Joint & VART::Joint::operator= ( const Joint j)

Definition at line 62 of file joint.cpp.

References dofList.

void VART::Joint::SetAtRest ( )

Put the joint in a rest position.

Definition at line 141 of file joint.cpp.

void VART::Joint::XmlPrintOn ( std::ostream &  os,
unsigned int  indent 
) const
virtual

Outputs XML representation of the scene.

Reimplemented from VART::SceneNode.

Definition at line 218 of file joint.cpp.

Member Data Documentation

std::list<Dof*> VART::Joint::dofList
protected

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