Base joint class. More...

#include <Joint.hpp>

Public Types

enum  LimitState { e_inactiveLimit, e_atLowerLimit, e_atUpperLimit, e_equalLimits }
 Limit state. More...
 

Public Member Functions

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...
 
virtual Length2 GetAnchorA () const =0
 Get the anchor point on body-A in world coordinates. More...
 
virtual Length2 GetAnchorB () const =0
 Get the anchor point on body-B in world coordinates. More...
 
virtual Momentum2 GetLinearReaction () const =0
 Get the linear reaction on body-B at the joint anchor. More...
 
virtual AngularMomentum GetAngularReaction () const =0
 Get the angular reaction on body-B. More...
 
virtual void Accept (JointVisitor &visitor) const =0
 Accepts a visitor. More...
 
virtual void Accept (JointVisitor &visitor)=0
 Accepts a visitor. 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...
 
virtual bool ShiftOrigin (const Length2)
 Shifts the origin for any points stored in world coordinates. More...
 

Static Public Member Functions

static bool IsOkay (const JointConf &def) noexcept
 Is the given definition okay. More...
 

Protected Member Functions

 Joint (const JointConf &def)
 Initializing constructor. More...
 

Friends

class JointAtty
 

Related Functions

(Note that these are not member functions.)

bool IsEnabled (const Joint &j) noexcept
 Short-cut function to determine if both bodies are enabled. More...
 
void SetAwake (Joint &j) noexcept
 Wakes up the joined bodies. More...
 
JointCounter GetWorldIndex (const Joint *joint)
 Gets the world index of the given joint. More...
 
JointType GetType (const Joint &joint) noexcept
 Gets the type of the given joint. More...
 

Detailed Description

Base joint class.

Joints are constraints that are used to constrain one or more bodies in various fashions. Some joints also feature limits and motors.

See also
World
Examples
World.cpp.

Definition at line 74 of file Joint.hpp.

Member Enumeration Documentation

◆ LimitState

Limit state.

Note
Only used by joints that implement some notion of a limited range.
Enumerator
e_inactiveLimit 

Inactive limit.

e_atLowerLimit 

At-lower limit.

e_atUpperLimit 

At-upper limit.

e_equalLimits 

Equal limit.

Equal limit is used to indicate that a joint's upper and lower limits are approximately the same.

Definition at line 80 of file Joint.hpp.

Constructor & Destructor Documentation

◆ ~Joint()

virtual playrho::d2::Joint::~Joint ( )
virtualdefaultnoexcept

◆ Joint()

playrho::d2::Joint::Joint ( const JointConf def)
explicitprotected

Initializing constructor.

Definition at line 87 of file Joint.cpp.

Member Function Documentation

◆ IsOkay()

bool playrho::d2::Joint::IsOkay ( const JointConf def)
staticnoexcept

Is the given definition okay.

Definition at line 98 of file Joint.cpp.

◆ GetBodyA()

Body * playrho::d2::Joint::GetBodyA ( ) const
inlinenoexcept

Gets the first body attached to this joint.

Definition at line 225 of file Joint.hpp.

◆ GetBodyB()

Body * playrho::d2::Joint::GetBodyB ( ) const
inlinenoexcept

Gets the second body attached to this joint.

Definition at line 230 of file Joint.hpp.

◆ GetAnchorA()

◆ GetAnchorB()

◆ GetLinearReaction()

◆ GetAngularReaction()

◆ Accept() [1/2]

virtual void playrho::d2::Joint::Accept ( JointVisitor visitor) const
pure virtual

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

Implemented in playrho::d2::GearJoint, playrho::d2::RevoluteJoint, playrho::d2::PulleyJoint, playrho::d2::PrismaticJoint, playrho::d2::TargetJoint, playrho::d2::RopeJoint, playrho::d2::DistanceJoint, playrho::d2::WheelJoint, playrho::d2::FrictionJoint, playrho::d2::MotorJoint, and playrho::d2::WeldJoint.

◆ Accept() [2/2]

virtual void playrho::d2::Joint::Accept ( JointVisitor visitor)
pure virtual

◆ GetUserData()

void * playrho::d2::Joint::GetUserData ( ) const
inlinenoexcept

Get the user data pointer.

Definition at line 235 of file Joint.hpp.

◆ SetUserData()

void playrho::d2::Joint::SetUserData ( void *  data)
inlinenoexcept

Set the user data pointer.

Definition at line 240 of file Joint.hpp.

◆ GetCollideConnected()

bool playrho::d2::Joint::GetCollideConnected ( ) const
inlinenoexcept

Gets collide connected.

Note
Modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap.

Definition at line 245 of file Joint.hpp.

◆ ShiftOrigin()

virtual bool playrho::d2::Joint::ShiftOrigin ( const  Length2)
inlinevirtual

Shifts the origin for any points stored in world coordinates.

Returns
true if shift done, false otherwise.

Reimplemented in playrho::d2::PulleyJoint, and playrho::d2::TargetJoint.

Definition at line 147 of file Joint.hpp.

Friends And Related Function Documentation

◆ JointAtty

friend class JointAtty
friend

Definition at line 155 of file Joint.hpp.

◆ IsEnabled()

bool IsEnabled ( const Joint j)
related

Short-cut function to determine if both bodies are enabled.

Definition at line 105 of file Joint.cpp.

◆ SetAwake()

void SetAwake ( Joint j)
related

Wakes up the joined bodies.

Definition at line 112 of file Joint.cpp.

◆ GetWorldIndex()

JointCounter GetWorldIndex ( const Joint joint)
related

Gets the world index of the given joint.

Definition at line 126 of file Joint.cpp.

◆ GetType()

JointType GetType ( const Joint joint)
related

Gets the type of the given joint.

Examples
World.cpp.

Definition at line 28 of file JointType.cpp.


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