Pulley joint. More...

#include <PulleyJoint.hpp>

Public Member Functions

 PulleyJoint (const PulleyJointConf &data)
 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 GetLocalAnchorA () const noexcept
 Gets the local anchor A. More...
 
Length2 GetLocalAnchorB () const noexcept
 Gets the local anchor B. More...
 
Length2 GetGroundAnchorA () const noexcept
 Get the first ground anchor. More...
 
Length2 GetGroundAnchorB () const noexcept
 Get the second ground anchor. More...
 
Length GetLengthA () const noexcept
 Get the current length of the segment attached to body-A. More...
 
Length GetLengthB () const noexcept
 Get the current length of the segment attached to body-B. More...
 
Real GetRatio () const noexcept
 Get the pulley 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...
 

Related Functions

(Note that these are not member functions.)

Length GetCurrentLengthA (const PulleyJoint &joint)
 Get the current length of the segment attached to body-A. More...
 
Length GetCurrentLengthB (const PulleyJoint &joint)
 Get the current length of the segment attached to body-B. More...
 
PulleyJointConf GetPulleyJointConf (const PulleyJoint &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...
 
- Static Public Member Functions inherited from playrho::d2::Joint
static bool IsOkay (const JointConf &def) noexcept
 Is the given definition okay. More...
 
- Protected Member Functions inherited from playrho::d2::Joint
 Joint (const JointConf &def)
 Initializing constructor. More...
 

Detailed Description

Pulley joint.

The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant.

Note
The force transmitted is scaled by the ratio.
Warning
the pulley joint can get a bit squirrelly by itself. They often work better when combined with prismatic joints. You should also cover the the anchor points with static shapes to prevent one side from going to zero length.

Definition at line 47 of file PulleyJoint.hpp.

Constructor & Destructor Documentation

◆ PulleyJoint()

playrho::d2::PulleyJoint::PulleyJoint ( const PulleyJointConf data)

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 44 of file PulleyJoint.cpp.

Member Function Documentation

◆ Accept() [1/2]

void playrho::d2::PulleyJoint::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 58 of file PulleyJoint.cpp.

◆ Accept() [2/2]

void playrho::d2::PulleyJoint::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 63 of file PulleyJoint.cpp.

◆ GetAnchorA()

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

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

Implements playrho::d2::Joint.

Definition at line 218 of file PulleyJoint.cpp.

◆ GetAnchorB()

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

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

Implements playrho::d2::Joint.

Definition at line 223 of file PulleyJoint.cpp.

◆ GetLinearReaction()

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

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

Implements playrho::d2::Joint.

Definition at line 228 of file PulleyJoint.cpp.

◆ GetAngularReaction()

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

Get the angular reaction on body-B.

Implements playrho::d2::Joint.

Definition at line 233 of file PulleyJoint.cpp.

◆ ShiftOrigin()

bool playrho::d2::PulleyJoint::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 238 of file PulleyJoint.cpp.

◆ GetLocalAnchorA()

Length2 playrho::d2::PulleyJoint::GetLocalAnchorA ( ) const
inlinenoexcept

Gets the local anchor A.

Definition at line 115 of file PulleyJoint.hpp.

◆ GetLocalAnchorB()

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

Gets the local anchor B.

Definition at line 120 of file PulleyJoint.hpp.

◆ GetGroundAnchorA()

Length2 playrho::d2::PulleyJoint::GetGroundAnchorA ( ) const
inlinenoexcept

Get the first ground anchor.

Definition at line 125 of file PulleyJoint.hpp.

◆ GetGroundAnchorB()

Length2 playrho::d2::PulleyJoint::GetGroundAnchorB ( ) const
inlinenoexcept

Get the second ground anchor.

Definition at line 130 of file PulleyJoint.hpp.

◆ GetLengthA()

Length playrho::d2::PulleyJoint::GetLengthA ( ) const
inlinenoexcept

Get the current length of the segment attached to body-A.

Definition at line 135 of file PulleyJoint.hpp.

◆ GetLengthB()

Length playrho::d2::PulleyJoint::GetLengthB ( ) const
inlinenoexcept

Get the current length of the segment attached to body-B.

Definition at line 140 of file PulleyJoint.hpp.

◆ GetRatio()

Real playrho::d2::PulleyJoint::GetRatio ( ) const
inlinenoexcept

Get the pulley ratio.

Definition at line 145 of file PulleyJoint.hpp.

Friends And Related Function Documentation

◆ GetCurrentLengthA()

Length GetCurrentLengthA ( const PulleyJoint joint)
related

Get the current length of the segment attached to body-A.

Definition at line 245 of file PulleyJoint.cpp.

◆ GetCurrentLengthB()

Length GetCurrentLengthB ( const PulleyJoint joint)
related

Get the current length of the segment attached to body-B.

Definition at line 251 of file PulleyJoint.cpp.

◆ GetPulleyJointConf()

PulleyJointConf GetPulleyJointConf ( const PulleyJoint joint)
related

Gets the definition data for the given joint.

Definition at line 43 of file PulleyJointConf.cpp.


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