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

Degree Of Freedom - basic component of a Joint. More...

#include <dof.h>

Inheritance diagram for VART::Dof:
VART::MemoryObj

Public Member Functions

 Dof ()
 
 Dof (const Dof &dof)
 
 Dof (const Point4D &vec, const Point4D &pos, float min, float max)
 Creates and initializes a DOF. More...
 
 ~Dof ()
 
Dofoperator= (const Dof &dof)
 
void SetDescription (const std::string &desc)
 
const std::string & GetDescription () const
 
Point4D GetAxis () const
 
Point4D GetOrigin () const
 
Point4D GetPosition () const
 
BezierGetEvoluta ()
 
void GetLim (Transform *resultPtr)
 
const TransformGetLim () const
 
float GetMin () const
 
float GetMax () const
 
float GetCurrentMin () const
 
float GetCurrentMax () const
 
float GetRest () const
 Returns DOF's rest position. More...
 
JointGetOwnerJoint () const
 
void SetEvoluta (Bezier *evol)
 
void SetLim (const Transform &t)
 
void SetAxis (Point4D vec)
 
void SetMin (float min)
 Sets DOF's minimal state. More...
 
void SetMax (float max)
 Sets DOF's maximal state. More...
 
void SetOwnerJoint (Joint *ow)
 
void MoveTo (float pos)
 Sets DOF's current position. More...
 
void MoveTo (float pos, unsigned int newPriority)
 Sets DOF's current position. More...
 
float GetCurrent () const
 Gets DOF's current position. More...
 
void Move (float variance)
 Changes DOF. More...
 
void SetRest (float rest)
 
void Set (const Point4D &vec, const Point4D &pos, float min, float max)
 Initializes a DOF previouly created with default constructor. More...
 
void Rest ()
 
void SetRangeModifier (Modifier *m)
 
ModifierGetRangeModifier ()
 
void ApplyTransformTo (Transform *ptrTrans) const
 Apply internal transform to some external transform. More...
 
void XmlPrintOn (std::ostream &os, unsigned int indent) const
 Outputs XML representation of the scene. More...
 
void Reconfigure (const Point4D &state, const Point4D &target)
 Reconfigure DOF to match a target direction. More...
 
- Public Member Functions inherited from VART::MemoryObj
 MemoryObj ()
 Default constructor. More...
 
 MemoryObj (const VART::MemoryObj &obj)
 Copy constructor. More...
 

Static Public Member Functions

static void ClearPriorities ()
 Resets priorities of all DOF instances. More...
 

Protected Member Functions

void ComputeLIM ()
 

Protected Attributes

Point4D position
 Together with "axis", defines the rotation axis. Relative to the parent reference system. More...
 
Point4D axis
 Together with "position", defines the rotation axis. Relative to the parent reference system. More...
 
unsigned int priority
 Priority of last DOF change. More...
 

Additional Inherited Members

- Public Attributes inherited from VART::MemoryObj
bool autoDelete
 

Detailed Description

Degree Of Freedom - basic component of a Joint.

A DOF is an axis of rotation, that may move along a 3D curve (the evoluta). The rotation of a DOF has a limited range that may change according to external elements, this is controlled by the rangeModifier (Modifier). There may exist a hierachy of DOFs, so that by changing one DOF, hierarchically lower DOFs are rotated. DOFs may not be shared among joints because they have a single pointer to the owner joint and because the joint destructor may destroy DOFs marked as autoDelete.

Definition at line 28 of file dof.h.

Constructor & Destructor Documentation

VART::Dof::Dof ( )

Definition at line 16 of file dof.cpp.

VART::Dof::Dof ( const Dof dof)

Definition at line 37 of file dof.cpp.

References axis, and position.

VART::Dof::Dof ( const Point4D vec,
const Point4D pos,
float  min,
float  max 
)

Creates and initializes a DOF.

Parameters
vec[in] A vector. Together with "pos", defines the rotation axis.
pos[in] A point. Together with "vec", defines the roatation axis.
min[in] An angle (radians). Minimal allowed rotation.
max[in] An angle (radians). Maximal allowed rotation. The DOF is created so that "current position" refers to zero rotation. If roatation range does not allow zero rotation, then the programmer should manually fix this using MoveTo.

Definition at line 58 of file dof.cpp.

References VART::Point4D::Normalize().

VART::Dof::~Dof ( )

Definition at line 75 of file dof.cpp.

Member Function Documentation

void VART::Dof::ApplyTransformTo ( VART::Transform ptrTrans) const

Apply internal transform to some external transform.

Pre-multiply the internal transform to the argument. As Transform is a pre-multiplication matrix, the resulting transform has the effect of its previous value followed by the DOF's internal transform. This method is called by Joint when it is collection DOFs' transforms in order to compose its final transform.

Parameters
ptrTrans[in,out] where to apply internal transform.

Definition at line 341 of file dof.cpp.

References VART::Transform::CopyMatrix().

void VART::Dof::ClearPriorities ( )
static

Resets priorities of all DOF instances.

For every instance of Dof, sets its priority to zero. Should be called at every render cycle, in a z-buffer-like scheme.

Definition at line 418 of file dof.cpp.

Referenced by VART::JointAction::Initializer::Initialize(), and VART::Action::MoveAllActive().

void VART::Dof::ComputeLIM ( )
protected

Definition at line 296 of file dof.cpp.

References VART::Point4D::SetW().

VART::Point4D VART::Dof::GetAxis ( ) const

Definition at line 123 of file dof.cpp.

float VART::Dof::GetCurrent ( ) const

Gets DOF's current position.

Definition at line 215 of file dof.cpp.

float VART::Dof::GetCurrentMax ( ) const

Definition at line 205 of file dof.cpp.

float VART::Dof::GetCurrentMin ( ) const

Definition at line 195 of file dof.cpp.

const std::string& VART::Dof::GetDescription ( ) const
inline

Definition at line 45 of file dof.h.

Bezier* VART::Dof::GetEvoluta ( )
inline

Definition at line 49 of file dof.h.

void VART::Dof::GetLim ( VART::Transform resultPtr)

Definition at line 140 of file dof.cpp.

References VART::Transform::CopyMatrix().

const VART::Transform & VART::Dof::GetLim ( ) const

Definition at line 135 of file dof.cpp.

float VART::Dof::GetMax ( ) const

Definition at line 190 of file dof.cpp.

float VART::Dof::GetMin ( ) const

Definition at line 185 of file dof.cpp.

VART::Point4D VART::Dof::GetOrigin ( ) const

Definition at line 128 of file dof.cpp.

VART::Joint * VART::Dof::GetOwnerJoint ( ) const

Definition at line 225 of file dof.cpp.

Referenced by VART::OffsetModifier::Modify().

Point4D VART::Dof::GetPosition ( ) const
inline

Definition at line 48 of file dof.h.

References position.

VART::Modifier * VART::Dof::GetRangeModifier ( )

Definition at line 336 of file dof.cpp.

float VART::Dof::GetRest ( ) const

Returns DOF's rest position.

Definition at line 220 of file dof.cpp.

void VART::Dof::Move ( float  variance)
inline

Changes DOF.

Changes how much the DOF is "bent"

Parameters
variance[in] How much to change the "current position".
See Also
MoveTo()

Definition at line 99 of file dof.h.

References MoveTo().

Referenced by VART::PolyaxialJoint::Adduct(), VART::BiaxialJoint::Adduct(), and VART::PolyaxialJoint::Twist().

void VART::Dof::MoveTo ( float  pos)

Sets DOF's current position.

Parameters
pos[in] A number in the range [0:1]

A value of zero means minimal rotation (see GetMin, SetMin) around the initial axis position (see GetAxis, GetOrigin, GetEvoluta and related "Set" methods). A value of one means maximal rotation. Other values are linear.

Definition at line 257 of file dof.cpp.

References VART::Point4D::SetW().

Referenced by Move(), VART::BiaxialJoint::SetAdductionTo(), VART::PolyaxialJoint::SetAductionTo(), VART::PolyaxialJoint::SetFlexionTo(), VART::BiaxialJoint::SetFlexionTo(), VART::UniaxialJoint::SetFlexionTo(), and VART::PolyaxialJoint::SetTwistTo().

void VART::Dof::MoveTo ( float  pos,
unsigned int  newPriority 
)

Sets DOF's current position.

Parameters
pos[in] A number in the range [0:1]
newPriority[in] Priority for DOF update (greater means greater priority)

Moves the DOF to given position if current update has priority over last update.

Definition at line 285 of file dof.cpp.

VART::Dof & VART::Dof::operator= ( const Dof dof)

Definition at line 82 of file dof.cpp.

References axis, and position.

void VART::Dof::Reconfigure ( const Point4D state,
const Point4D target 
)

Reconfigure DOF to match a target direction.

Given a state (some direction representing current DOF configuration), puts itself in a configuration that would make state as close as possible to target.

Definition at line 346 of file dof.cpp.

References VART::Point4D::CrossProduct(), and VART::Point4D::DotProduct().

void VART::Dof::Rest ( )

Definition at line 326 of file dof.cpp.

void VART::Dof::Set ( const Point4D vec,
const Point4D pos,
float  min,
float  max 
)

Initializes a DOF previouly created with default constructor.

Newly created DOFs are set at zero rotation. Use GetCurrent to find initial positial.

Parameters
vec[in] Rotation vector;
pos[in] DOF position (defines an axis along with "vec");
min[in] Minimal bending angle in radians;
max[in] Maximal bending angle in radians;

Definition at line 102 of file dof.cpp.

References VART::Point4D::Normalize().

Referenced by VART::XmlScene::loadDofs().

void VART::Dof::SetAxis ( VART::Point4D  vec)

Definition at line 230 of file dof.cpp.

void VART::Dof::SetDescription ( const std::string &  desc)

Definition at line 118 of file dof.cpp.

Referenced by VART::XmlScene::loadDofs().

void VART::Dof::SetEvoluta ( VART::Bezier evol)

Definition at line 235 of file dof.cpp.

void VART::Dof::SetLim ( const Transform t)

Definition at line 242 of file dof.cpp.

void VART::Dof::SetMax ( float  max)

Sets DOF's maximal state.

Parameters
max[in] An angle in radians (for a rotational dof).

DOFs translate to simple transforms (usually rotations). They have a minimal and a maximal state. In case of a rotational DOF, the maximal state refers to the maximal angle (in radians) that the DOF may represent as a rotation.

Definition at line 252 of file dof.cpp.

void VART::Dof::SetMin ( float  min)

Sets DOF's minimal state.

Parameters
min[in] An angle in radians (for a rotational dof).

DOFs translate to simple transforms (usually rotations). They have a minimal and a maximal state. In case of a rotational DOF, the minimal state refers to the minimal angle (in radians) that the DOF may represent as a rotation.

Definition at line 247 of file dof.cpp.

void VART::Dof::SetOwnerJoint ( VART::Joint ow)

Definition at line 316 of file dof.cpp.

Referenced by VART::Joint::AddDof(), and VART::Joint::CopyDofListFrom().

void VART::Dof::SetRangeModifier ( VART::Modifier m)

Definition at line 331 of file dof.cpp.

void VART::Dof::SetRest ( float  rest)

Definition at line 321 of file dof.cpp.

Referenced by VART::XmlScene::loadDofs().

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

Outputs XML representation of the scene.

Definition at line 426 of file dof.cpp.

Member Data Documentation

Point4D VART::Dof::axis
protected

Together with "position", defines the rotation axis. Relative to the parent reference system.

Definition at line 155 of file dof.h.

Referenced by Dof(), and operator=().

Point4D VART::Dof::position
protected

Together with "axis", defines the rotation axis. Relative to the parent reference system.

Definition at line 153 of file dof.h.

Referenced by Dof(), GetPosition(), and operator=().

unsigned int VART::Dof::priority
protected

Priority of last DOF change.

When several elements try to update a DOF, the priority attribute controls which of them will really affect the DOF. Lower numbers mean lower priority.

Definition at line 160 of file dof.h.


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