Target Joint. More...

#include <TargetJoint.hpp>

Public Member Functions

 TargetJoint (const TargetJointConf &def)
 Initializing constructor. More...
 
void Accept (JointVisitor &visitor) const override
 Accepts a visitor. More...
 
void Accept (JointVisitor &visitor) override
 Accepts a visitor. More...
 
Length2 GetAnchorA () const override
 Get the anchor point on body-A in world coordinates. More...
 
Length2 GetAnchorB () const override
 Get the anchor point on body-B in world coordinates. More...
 
Momentum2 GetLinearReaction () const override
 Get the linear reaction on body-B at the joint anchor. More...
 
AngularMomentum GetAngularReaction () const override
 Get the angular reaction on body-B. More...
 
bool ShiftOrigin (const Length2 newOrigin) override
 Shifts the origin for any points stored in world coordinates. More...
 
Length2 GetLocalAnchorB () const noexcept
 Gets the local anchor B. More...
 
void SetTarget (const Length2 target) noexcept
 Sets the target point. More...
 
Length2 GetTarget () const noexcept
 Gets the target point. More...
 
void SetMaxForce (NonNegative< Force > force) noexcept
 Sets the maximum force. More...
 
NonNegative< ForceGetMaxForce () const noexcept
 Gets the maximum force. More...
 
void SetFrequency (NonNegative< Frequency > hz) noexcept
 Sets the frequency. More...
 
NonNegative< FrequencyGetFrequency () const noexcept
 Gets the frequency. More...
 
void SetDampingRatio (NonNegative< Real > ratio) noexcept
 Sets the damping ratio. More...
 
NonNegative< RealGetDampingRatio () const noexcept
 Gets the damping ratio. More...
 
- Public Member Functions inherited from playrho::d2::Joint
virtual ~Joint () noexcept=default
 
BodyGetBodyA () const noexcept
 Gets the first body attached to this joint. More...
 
BodyGetBodyB () const noexcept
 Gets the second body attached to this joint. More...
 
void * GetUserData () const noexcept
 Get the user data pointer. More...
 
void SetUserData (void *data) noexcept
 Set the user data pointer. More...
 
bool GetCollideConnected () const noexcept
 Gets collide connected. More...
 

Static Public Member Functions

static bool IsOkay (const TargetJointConf &def) noexcept
 Is the given definition okay. More...
 
- Static Public Member Functions inherited from playrho::d2::Joint
static bool IsOkay (const JointConf &def) noexcept
 Is the given definition okay. More...
 

Related Functions

(Note that these are not member functions.)

TargetJointConf GetTargetJointConf (const TargetJoint &joint) noexcept
 Gets the definition data for the given joint. More...
 

Additional Inherited Members

- Public Types inherited from playrho::d2::Joint
enum  LimitState { e_inactiveLimit, e_atLowerLimit, e_atUpperLimit, e_equalLimits }
 Limit state. More...
 
- Protected Member Functions inherited from playrho::d2::Joint
 Joint (const JointConf &def)
 Initializing constructor. More...
 

Detailed Description

Target Joint.

A target joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.

Note
This structure is 120-bytes large (using a 4-byte Real on at least one 64-bit architecture/build).
Examples
World.cpp.

Definition at line 42 of file TargetJoint.hpp.

Constructor & Destructor Documentation

◆ TargetJoint()

playrho::d2::TargetJoint::TargetJoint ( const TargetJointConf def)

Initializing constructor.

Attention
To create or use the joint within a world instance, call that world instance's create joint method instead of calling this constructor directly.
See also
World::CreateJoint

Definition at line 53 of file TargetJoint.cpp.

Member Function Documentation

◆ IsOkay()

bool playrho::d2::TargetJoint::IsOkay ( const TargetJointConf def)
staticnoexcept

Is the given definition okay.

Definition at line 40 of file TargetJoint.cpp.

◆ Accept() [1/2]

void playrho::d2::TargetJoint::Accept ( JointVisitor visitor) const
overridevirtual

Accepts a visitor.

This is the Accept method definition of a "visitor design pattern" for for doing joint subclass specific types of processing for a constant joint.

See also
JointVisitor
https://en.wikipedia.org/wiki/Visitor_pattern

Implements playrho::d2::Joint.

Definition at line 67 of file TargetJoint.cpp.

◆ Accept() [2/2]

void playrho::d2::TargetJoint::Accept ( JointVisitor visitor)
overridevirtual

Accepts a visitor.

This is the Accept method definition of a "visitor design pattern" for for doing joint subclass specific types of processing.

See also
JointVisitor
https://en.wikipedia.org/wiki/Visitor_pattern

Implements playrho::d2::Joint.

Definition at line 72 of file TargetJoint.cpp.

◆ GetAnchorA()

Length2 playrho::d2::TargetJoint::GetAnchorA ( ) const
overridevirtual

Get the anchor point on body-A in world coordinates.

Implements playrho::d2::Joint.

Definition at line 206 of file TargetJoint.cpp.

◆ GetAnchorB()

Length2 playrho::d2::TargetJoint::GetAnchorB ( ) const
overridevirtual

Get the anchor point on body-B in world coordinates.

Implements playrho::d2::Joint.

Definition at line 211 of file TargetJoint.cpp.

◆ GetLinearReaction()

Momentum2 playrho::d2::TargetJoint::GetLinearReaction ( ) const
overridevirtual

Get the linear reaction on body-B at the joint anchor.

Implements playrho::d2::Joint.

Definition at line 216 of file TargetJoint.cpp.

◆ GetAngularReaction()

AngularMomentum playrho::d2::TargetJoint::GetAngularReaction ( ) const
overridevirtual

Get the angular reaction on body-B.

Implements playrho::d2::Joint.

Definition at line 221 of file TargetJoint.cpp.

◆ ShiftOrigin()

bool playrho::d2::TargetJoint::ShiftOrigin ( const Length2  Length2)
overridevirtual

Shifts the origin for any points stored in world coordinates.

Returns
true if shift done, false otherwise.

Reimplemented from playrho::d2::Joint.

Definition at line 226 of file TargetJoint.cpp.

◆ GetLocalAnchorB()

Length2 playrho::d2::TargetJoint::GetLocalAnchorB ( ) const
inlinenoexcept

Gets the local anchor B.

Definition at line 115 of file TargetJoint.hpp.

◆ SetTarget()

void playrho::d2::TargetJoint::SetTarget ( const Length2  target)
noexcept

Sets the target point.

Definition at line 77 of file TargetJoint.cpp.

◆ GetTarget()

Length2 playrho::d2::TargetJoint::GetTarget ( ) const
inlinenoexcept

Gets the target point.

Definition at line 120 of file TargetJoint.hpp.

◆ SetMaxForce()

void playrho::d2::TargetJoint::SetMaxForce ( NonNegative< Force force)
inlinenoexcept

Sets the maximum force.

Definition at line 125 of file TargetJoint.hpp.

◆ GetMaxForce()

NonNegative< Force > playrho::d2::TargetJoint::GetMaxForce ( ) const
inlinenoexcept

Gets the maximum force.

Definition at line 130 of file TargetJoint.hpp.

◆ SetFrequency()

void playrho::d2::TargetJoint::SetFrequency ( NonNegative< Frequency hz)
inlinenoexcept

Sets the frequency.

Definition at line 135 of file TargetJoint.hpp.

◆ GetFrequency()

NonNegative< Frequency > playrho::d2::TargetJoint::GetFrequency ( ) const
inlinenoexcept

Gets the frequency.

Definition at line 140 of file TargetJoint.hpp.

◆ SetDampingRatio()

void playrho::d2::TargetJoint::SetDampingRatio ( NonNegative< Real ratio)
inlinenoexcept

Sets the damping ratio.

Definition at line 145 of file TargetJoint.hpp.

◆ GetDampingRatio()

NonNegative< Real > playrho::d2::TargetJoint::GetDampingRatio ( ) const
inlinenoexcept

Gets the damping ratio.

Definition at line 150 of file TargetJoint.hpp.

Friends And Related Function Documentation

◆ GetTargetJointConf()

TargetJointConf GetTargetJointConf ( const TargetJoint joint)
related

Gets the definition data for the given joint.

Definition at line 28 of file TargetJointConf.cpp.


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