# b2DistanceJoint Class Reference

`#include <b2DistanceJoint.h>`

Inheritance diagram for b2DistanceJoint:

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 | SetLength (float32 length)
float32 | GetLength () const
void | SetFrequency (float32 hz)
float32 | GetFrequency () const
void | SetDampingRatio (float32 ratio)
float32 | GetDampingRatio () const
## Protected Member Functions
| b2DistanceJoint (const b2DistanceJointDef *data)
void | InitVelocityConstraints (const b2TimeStep &step)
void | SolveVelocityConstraints (const b2TimeStep &step)
bool | SolvePositionConstraints (float32 baumgarte)
## Protected Attributes
b2Vec2 | m_localAnchor1
b2Vec2 | m_localAnchor2
b2Vec2 | m_u
float32 | m_frequencyHz
float32 | m_dampingRatio
float32 | m_gamma
float32 | m_bias
float32 | m_impulse
float32 | m_mass
float32 | m_length
## Friends
class | b2Joint

## Detailed Description

A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.

## Constructor & Destructor Documentation

b2DistanceJoint::b2DistanceJoint | ( | const b2DistanceJointDef * | data | ) | `[protected]`

## Member Function Documentation

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

Get the anchor point on bodyA in world coordinates.

Implements b2Joint.

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

Get the anchor point on bodyB in world coordinates.

Implements b2Joint.

float32 b2DistanceJoint::GetDampingRatio | ( |  | ) | const`[inline]`

float32 b2DistanceJoint::GetFrequency | ( |  | ) | const`[inline]`

float32 b2DistanceJoint::GetLength | ( |  | ) | const`[inline]`

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

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

Implements b2Joint.

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

Get the reaction torque on body2 in N*m.

Implements b2Joint.

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

Implements b2Joint.

void b2DistanceJoint::SetDampingRatio | ( | float32 | ratio | ) | `[inline]`

void b2DistanceJoint::SetFrequency | ( | float32 | hz | ) | `[inline]`

void b2DistanceJoint::SetLength | ( | float32 | length | ) | `[inline]`

Set/get the natural length. Manipulating the length can lead to non-physical behavior when the frequency is zero.

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

Implements b2Joint.

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

Implements b2Joint.

## Friends And Related Function Documentation

friend class b2Joint`[friend]`

## Member Data Documentation

float32 b2DistanceJoint::m_bias`[protected]`

float32 b2DistanceJoint::m_dampingRatio`[protected]`

float32 b2DistanceJoint::m_frequencyHz`[protected]`

float32 b2DistanceJoint::m_gamma`[protected]`

float32 b2DistanceJoint::m_impulse`[protected]`

float32 b2DistanceJoint::m_length`[protected]`

b2Vec2 b2DistanceJoint::m_localAnchor1`[protected]`

b2Vec2 b2DistanceJoint::m_localAnchor2`[protected]`

float32 b2DistanceJoint::m_mass`[protected]`

b2Vec2 b2DistanceJoint::m_u`[protected]`

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

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