Box2D: b2GearJoint Class Reference

# b2GearJoint Class Reference

`#include <b2GearJoint.h>`

Inheritance diagram for b2GearJoint:

List of all members.

## Public Member Functions

b2Vec2 | GetAnchorA () const
| Get the anchor point on bodyA in world coordinates.
b2Vec2 | GetAnchorB () const
| Get the anchor point on bodyB in world coordinates.
b2Vec2 | GetReactionForce (float32 inv_dt) const
| Get the reaction force on body2 at the joint anchor in Newtons.
float32 | GetReactionTorque (float32 inv_dt) const
| Get the reaction torque on body2 in N*m.
void | SetRatio (float32 ratio)
| Set/Get the gear ratio.
float32 | GetRatio () const

## Protected Member Functions

| b2GearJoint (const b2GearJointDef *data)
void | InitVelocityConstraints (const b2TimeStep &step)
void | SolveVelocityConstraints (const b2TimeStep &step)
bool | SolvePositionConstraints (float32 baumgarte)

## Protected Attributes

b2Body * | m_ground1
b2Body * | m_ground2
b2RevoluteJoint * | m_revolute1
b2PrismaticJoint * | m_prismatic1
b2RevoluteJoint * | m_revolute2
b2PrismaticJoint * | m_prismatic2
b2Vec2 | m_groundAnchor1
b2Vec2 | m_groundAnchor2
b2Vec2 | m_localAnchor1
b2Vec2 | m_localAnchor2
b2Jacobian | m_J
float32 | m_constant
float32 | m_ratio
float32 | m_mass
float32 | m_impulse

## Friends

class | b2Joint

## 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:
  The revolute and prismatic joints must be attached to fixed bodies (which must be body1 on those joints).

## Constructor & Destructor Documentation

b2GearJoint::b2GearJoint | ( | const b2GearJointDef * | data | ) | `[protected]`

## Member Function Documentation

b2Vec2 b2GearJoint::GetAnchorA | ( |  | ) | const`[virtual]`

Get the anchor point on bodyA in world coordinates.

Implements b2Joint.

b2Vec2 b2GearJoint::GetAnchorB | ( |  | ) | const`[virtual]`

Get the anchor point on bodyB in world coordinates.

Implements b2Joint.

float32 b2GearJoint::GetRatio | ( |  | ) | const

b2Vec2 b2GearJoint::GetReactionForce | ( | float32 | inv_dt | ) | const`[virtual]`

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

Implements b2Joint.

float32 b2GearJoint::GetReactionTorque | ( | float32 | inv_dt | ) | const`[virtual]`

Get the reaction torque on body2 in N*m.

Implements b2Joint.

void b2GearJoint::InitVelocityConstraints | ( | const b2TimeStep & | step | ) | `[protected, virtual]`

Implements b2Joint.

void b2GearJoint::SetRatio | ( | float32 | ratio | ) |

Set/Get the gear ratio.

bool b2GearJoint::SolvePositionConstraints | ( | float32 | baumgarte | ) | `[protected, virtual]`

Implements b2Joint.

void b2GearJoint::SolveVelocityConstraints | ( | const b2TimeStep & | step | ) | `[protected, virtual]`

Implements b2Joint.

## Friends And Related Function Documentation

friend class b2Joint`[friend]`

## Member Data Documentation

float32 b2GearJoint::m_constant`[protected]`

b2Body* b2GearJoint::m_ground1`[protected]`

b2Body* b2GearJoint::m_ground2`[protected]`

b2Vec2 b2GearJoint::m_groundAnchor1`[protected]`

b2Vec2 b2GearJoint::m_groundAnchor2`[protected]`

float32 b2GearJoint::m_impulse`[protected]`

b2Jacobian b2GearJoint::m_J`[protected]`

b2Vec2 b2GearJoint::m_localAnchor1`[protected]`

b2Vec2 b2GearJoint::m_localAnchor2`[protected]`

float32 b2GearJoint::m_mass`[protected]`

b2PrismaticJoint* b2GearJoint::m_prismatic1`[protected]`

b2PrismaticJoint* b2GearJoint::m_prismatic2`[protected]`

float32 b2GearJoint::m_ratio`[protected]`

b2RevoluteJoint* b2GearJoint::m_revolute1`[protected]`

b2RevoluteJoint* b2GearJoint::m_revolute2`[protected]`

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

- Box2D/Box2D/Dynamics/Joints/b2GearJoint.h
- Box2D/Box2D/Dynamics/Joints/b2GearJoint.cpp