Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Member Functions | List of all members
box2d::GearJoint Class Reference

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. More...

#include <GearJoint.hpp>

Inheritance diagram for box2d::GearJoint:
box2d::Joint

Public Member Functions

 GearJoint (const GearJointDef &data)
 
Length2D GetAnchorA () const override
 Get the anchor point on bodyA in world coordinates. More...
 
Length2D GetAnchorB () const override
 Get the anchor point on bodyB in world coordinates. More...
 
Force2D GetReactionForce (Frequency inv_dt) const override
 Get the reaction force on bodyB at the joint anchor in Newtons. More...
 
Torque GetReactionTorque (Frequency inv_dt) const override
 Get the reaction torque on bodyB in N*m. More...
 
Length2D GetLocalAnchorA () const
 The local anchor point relative to bodyA's origin. More...
 
Length2D GetLocalAnchorB () const
 The local anchor point relative to bodyB's origin. More...
 
JointGetJoint1 () noexcept
 Get the first joint. More...
 
JointGetJoint2 () noexcept
 Get the second joint. More...
 
const JointGetJoint1 () const noexcept
 Get the first joint. More...
 
const JointGetJoint2 () const noexcept
 Get the second joint. More...
 
void SetRatio (RealNum ratio)
 Set/Get the gear ratio. More...
 
RealNum GetRatio () const
 
- Public Member Functions inherited from box2d::Joint
JointType GetType () const noexcept
 Get the type of the concrete joint. More...
 
BodyGetBodyA () noexcept
 Get the first body attached to this joint. More...
 
BodyGetBodyB () noexcept
 Get the second body attached to this joint. More...
 
const BodyGetBodyA () const noexcept
 Get the first body attached to this joint. More...
 
const BodyGetBodyB () const noexcept
 Get 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
 Get collide connected. Note: modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap. More...
 
virtual void ShiftOrigin (const Length2D newOrigin)
 Shift the origin for any points stored in world coordinates. More...
 

Additional Inherited Members

- Public Types inherited from box2d::Joint
enum  LimitState { e_inactiveLimit, e_atLowerLimit, e_atUpperLimit, e_equalLimits }
 
using index_t = size_t
 
- Static Public Member Functions inherited from box2d::Joint
static bool IsOkay (const JointDef &def) noexcept
 
- Protected Member Functions inherited from box2d::Joint
 Joint (const JointDef &def)
 
virtual ~Joint () noexcept
 
void SetBodyA (Body *value) noexcept
 
void SetBodyB (Body *value) noexcept
 

Detailed Description

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 joint1 or joint2 is destroyed.

Constructor & Destructor Documentation

◆ GearJoint()

GearJoint::GearJoint ( const GearJointDef data)

Member Function Documentation

◆ GetAnchorA()

Length2D GearJoint::GetAnchorA ( ) const
overridevirtual

Get the anchor point on bodyA in world coordinates.

Implements box2d::Joint.

◆ GetAnchorB()

Length2D GearJoint::GetAnchorB ( ) const
overridevirtual

Get the anchor point on bodyB in world coordinates.

Implements box2d::Joint.

◆ GetJoint1() [1/2]

Joint* box2d::GearJoint::GetJoint1 ( )
inlinenoexcept

Get the first joint.

◆ GetJoint1() [2/2]

const Joint* box2d::GearJoint::GetJoint1 ( ) const
inlinenoexcept

Get the first joint.

◆ GetJoint2() [1/2]

Joint* box2d::GearJoint::GetJoint2 ( )
inlinenoexcept

Get the second joint.

◆ GetJoint2() [2/2]

const Joint* box2d::GearJoint::GetJoint2 ( ) const
inlinenoexcept

Get the second joint.

◆ GetLocalAnchorA()

Length2D box2d::GearJoint::GetLocalAnchorA ( ) const
inline

The local anchor point relative to bodyA's origin.

◆ GetLocalAnchorB()

Length2D box2d::GearJoint::GetLocalAnchorB ( ) const
inline

The local anchor point relative to bodyB's origin.

◆ GetRatio()

RealNum GearJoint::GetRatio ( ) const

◆ GetReactionForce()

Force2D GearJoint::GetReactionForce ( Frequency  inv_dt) const
overridevirtual

Get the reaction force on bodyB at the joint anchor in Newtons.

Implements box2d::Joint.

◆ GetReactionTorque()

Torque GearJoint::GetReactionTorque ( Frequency  inv_dt) const
overridevirtual

Get the reaction torque on bodyB in N*m.

Implements box2d::Joint.

◆ SetRatio()

void GearJoint::SetRatio ( RealNum  ratio)

Set/Get the gear ratio.


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