PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::GearJointConf Struct Reference

Gear joint definition. More...

#include <GearJointConf.hpp>

Inheritance diagram for playrho::d2::GearJointConf:
[legend]
Collaboration diagram for playrho::d2::GearJointConf:
[legend]

Public Types

using super = JointBuilder< GearJointConf >
 Super type.
 
- Public Types inherited from playrho::d2::JointBuilder< GearJointConf >
using value_type = GearJointConf
 Value type.
 
using reference = value_type &
 Reference type.
 

Public Member Functions

constexpr GearJointConf ()=default
 Default constructor.
 
 GearJointConf (BodyID bA, BodyID bB, BodyID bC, BodyID bD) noexcept
 Initializing constructor.
 
constexpr auto & UseRatio (Real v) noexcept
 Uses the given ratio value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< GearJointConf >
constexpr reference UseBodyA (BodyID b) noexcept
 Use value for body A setting.
 
constexpr reference UseBodyB (BodyID b) noexcept
 Use value for body B setting.
 
constexpr reference UseCollideConnected (bool v) noexcept
 Use value for collide connected setting.
 

Public Attributes

BodyID bodyC = InvalidBodyID
 Identifier of body C.
 
BodyID bodyD = InvalidBodyID
 Identifier of body D.
 
TypeID type1 = GetTypeID<void>()
 Type of the first joint.
 
TypeID type2 = GetTypeID<void>()
 Type of the second joint.
 
Length2 localAnchorA {}
 Local anchor A.
 
Length2 localAnchorB {}
 Local anchor B.
 
Length2 localAnchorC {}
 Local anchor C.
 
Length2 localAnchorD {}
 Local anchor D.
 
UnitVec localAxis1
 Local axis 1. Used when type1 is not Revolute.
 
UnitVec localAxis2
 Local axis 2. Used when type2 is not Revolute.
 
Angle referenceAngle1 = 0_deg
 Reference angle of joint 1. Used when type1 is Revolute.
 
Angle referenceAngle2 = 0_deg
 Reference angle of joint 2. Used when type2 is Revolute.
 
Real ratio = Real{1}
 The gear ratio. More...
 
Real constant = Real{0}
 Constant applied with the ratio. More...
 
Momentum impulse = 0_Ns
 Impulse.
 
Vec2 JvAC = Vec2{}
 AC Jv data.
 
Vec2 JvBD = {}
 BD Jv data.
 
Length JwA = 0_m
 A Jw data.
 
Length JwB = 0_m
 B Jw data.
 
Length JwC = 0_m
 C Jw data.
 
Length JwD = 0_m
 D Jw data.
 
Real mass = 0
 Either linear mass or angular mass.
 
- Public Attributes inherited from playrho::d2::JointConf
BodyID bodyA = InvalidBodyID
 1st attached body.
 
BodyID bodyB = InvalidBodyID
 2nd attached body.
 
bool collideConnected = false
 Collide connected. More...
 

Related Functions

(Note that these are not member functions.)

constexpr Momentum2 GetLinearReaction (const GearJointConf &object)
 Gets the current linear reaction for the given configuration.
 
constexpr AngularMomentum GetAngularReaction (const GearJointConf &object)
 Gets the current angular reaction for the given configuration.
 
constexpr bool ShiftOrigin (GearJointConf &, Length2) noexcept
 Shifts the origin notion of the given configuration.
 
void InitVelocity (GearJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
bool SolveVelocity (GearJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 
bool SolvePosition (const GearJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
constexpr auto GetRatio (const GearJointConf &object) noexcept
 Free function for getting the ratio value of the given configuration.
 
constexpr auto SetRatio (GearJointConf &object, Real value) noexcept
 Free function for setting the ratio value of the given configuration.
 
constexpr auto GetConstant (const GearJointConf &object) noexcept
 Free function for getting the constant value of the given configuration.
 
constexpr auto GetType1 (const GearJointConf &object) noexcept
 Free function for getting joint 1 type value of the given configuration.
 
constexpr auto GetType2 (const GearJointConf &object) noexcept
 Free function for getting joint 2 type value of the given configuration.
 

Detailed Description

Gear joint definition.

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.
See also
Joint, World::CreateJoint
Examples
GearJoint.cpp.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( GearJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step,
const ConstraintSolverConf conf 
)
related

Initializes velocity constraint data based on the given solver data.

Note
This MUST be called prior to calling SolveVelocity.
See also
SolveVelocity.

◆ SolvePosition()

bool SolvePosition ( const GearJointConf object,
std::vector< BodyConstraint > &  bodies,
const ConstraintSolverConf conf 
)
related

Solves the position constraint.

Returns
true if the position errors are within tolerance.

◆ SolveVelocity()

bool SolveVelocity ( GearJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step 
)
related

Solves velocity constraint.

Precondition
InitVelocity has been called.
See also
InitVelocity.
Returns
true if velocity is "solved", false otherwise.

Member Data Documentation

◆ constant

Real playrho::d2::GearJointConf::constant = Real{0}

Constant applied with the ratio.

See also
ratio.

◆ ratio

Real playrho::d2::GearJointConf::ratio = Real{1}

The gear ratio.

See also
constant, GearJoint.

Referenced by UseRatio().


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