Gear joint. More...

#include <GearJoint.hpp>

Public Member Functions

 GearJoint (const GearJointConf &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...
 
Length2 GetLocalAnchorA () const noexcept
 Gets the local anchor point relative to body A's origin. More...
 
Length2 GetLocalAnchorB () const noexcept
 Gets the local anchor point relative to body B's origin. More...
 
NonNull< Joint * > GetJoint1 () const noexcept
 Gets the first joint. More...
 
NonNull< Joint * > GetJoint2 () const noexcept
 Gets the second joint. More...
 
void SetRatio (Real ratio)
 Sets the gear ratio. More...
 
Real GetRatio () const noexcept
 Gets the ratio for position solving. More...
 
Real GetConstant () const noexcept
 Gets the constant for position solving. 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...
 
virtual bool ShiftOrigin (const Length2)
 Shifts the origin for any points stored in world coordinates. More...
 

Static Public Member Functions

static bool IsOkay (const GearJointConf &data) 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.)

GearJointConf GetGearJointConf (const GearJoint &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

Gear joint.

A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant. The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length.

Warning
You have to manually destroy the gear joint if joint-1 or joint-2 is destroyed.

Definition at line 46 of file GearJoint.hpp.

Constructor & Destructor Documentation

◆ GearJoint()

playrho::d2::GearJoint::GearJoint ( const GearJointConf 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 77 of file GearJoint.cpp.

Member Function Documentation

◆ IsOkay()

bool playrho::d2::GearJoint::IsOkay ( const GearJointConf data)
staticnoexcept

Is the given definition okay.

Definition at line 62 of file GearJoint.cpp.

◆ Accept() [1/2]

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

◆ Accept() [2/2]

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

◆ GetAnchorA()

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

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

Implements playrho::d2::Joint.

Definition at line 428 of file GearJoint.cpp.

◆ GetAnchorB()

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

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

Implements playrho::d2::Joint.

Definition at line 433 of file GearJoint.cpp.

◆ GetLinearReaction()

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

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

Implements playrho::d2::Joint.

Definition at line 438 of file GearJoint.cpp.

◆ GetAngularReaction()

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

Get the angular reaction on body-B.

Implements playrho::d2::Joint.

Definition at line 443 of file GearJoint.cpp.

◆ GetLocalAnchorA()

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

Gets the local anchor point relative to body A's origin.

Definition at line 69 of file GearJoint.hpp.

◆ GetLocalAnchorB()

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

Gets the local anchor point relative to body B's origin.

Definition at line 72 of file GearJoint.hpp.

◆ GetJoint1()

NonNull<Joint*> playrho::d2::GearJoint::GetJoint1 ( ) const
inlinenoexcept

Gets the first joint.

Definition at line 75 of file GearJoint.hpp.

◆ GetJoint2()

NonNull<Joint*> playrho::d2::GearJoint::GetJoint2 ( ) const
inlinenoexcept

Gets the second joint.

Definition at line 78 of file GearJoint.hpp.

◆ SetRatio()

void playrho::d2::GearJoint::SetRatio ( Real  ratio)

Sets the gear ratio.

Definition at line 448 of file GearJoint.cpp.

◆ GetRatio()

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

Gets the ratio for position solving.

Definition at line 135 of file GearJoint.hpp.

◆ GetConstant()

Real playrho::d2::GearJoint::GetConstant ( ) const
inlinenoexcept

Gets the constant for position solving.

Definition at line 140 of file GearJoint.hpp.

Friends And Related Function Documentation

◆ GetGearJointConf()

GearJointConf GetGearJointConf ( const GearJoint joint)
related

Gets the definition data for the given joint.

Definition at line 35 of file GearJointConf.cpp.


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