PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::PulleyJointConf Struct Reference

Pulley joint definition. More...

#include <playrho/d2/PulleyJointConf.hpp>

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

Public Types

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

Public Member Functions

 PulleyJointConf () noexcept
 Default constructor.
 
 PulleyJointConf (BodyID bA, BodyID bB, const Length2 &gaA=DefaultGroundAnchorA, const Length2 &gaB=DefaultGroundAnchorB, const Length2 &laA=DefaultLocalAnchorA, const Length2 &laB=DefaultLocalAnchorB, Length lA=0_m, Length lB=0_m)
 
constexpr auto & UseRatio (Real v) noexcept
 Uses the given ratio value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< PulleyJointConf >
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

Length2 groundAnchorA = DefaultGroundAnchorA
 The first ground anchor in world coordinates. This point never moves.
 
Length2 groundAnchorB = DefaultGroundAnchorB
 The second ground anchor in world coordinates. This point never moves.
 
Momentum impulse = 0_Ns
 Impulse.
 
Length lengthA = 0_m
 The a reference length for the segment attached to body-A.
 
Length lengthB = 0_m
 The a reference length for the segment attached to body-B.
 
Length2 localAnchorA = DefaultLocalAnchorA
 The local anchor point relative to body A's origin.
 
Length2 localAnchorB = DefaultLocalAnchorB
 The local anchor point relative to body B's origin.
 
Mass mass = 0_kg
 Mass.
 
Length2 rA {}
 Relative A.
 
Real ratio = 1
 The pulley ratio, used to simulate a block-and-tackle.
 
Length2 rB {}
 Relative B.
 
UnitVec uA
 Unit vector A.
 
UnitVec uB
 Unit vector B.
 
- 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...
 

Static Public Attributes

static constexpr Length2 DefaultGroundAnchorA = Length2{-1_m, +1_m}
 Default ground anchor A.
 
static constexpr Length2 DefaultGroundAnchorB = Length2{+1_m, +1_m}
 Default ground anchor B.
 
static constexpr Length2 DefaultLocalAnchorA = Length2{-1_m, 0_m}
 Default local anchor A.
 
static constexpr Length2 DefaultLocalAnchorB = Length2{+1_m, 0_m}
 Default local anchor B.
 

Related Functions

(Note that these are not member functions.)

constexpr AngularMomentum GetAngularReaction (const PulleyJointConf &) noexcept
 Gets the current angular reaction of the given configuration.
 
constexpr auto GetLengthA (const PulleyJointConf &object) noexcept
 Free function for getting the length A value of the given configuration.
 
constexpr auto GetLengthB (const PulleyJointConf &object) noexcept
 Free function for getting the length B value of the given configuration.
 
constexpr Momentum2 GetLinearReaction (const PulleyJointConf &object) noexcept
 Gets the current linear reaction of the given configuration.
 
void InitVelocity (PulleyJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
constexpr auto SetRatio (PulleyJointConf &object, Real value) noexcept
 Free function for setting the ratio value of the given configuration.
 
bool ShiftOrigin (PulleyJointConf &object, const Length2 &newOrigin) noexcept
 Shifts the origin notion of the given configuration.
 
bool SolvePosition (const PulleyJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
bool SolveVelocity (PulleyJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 

Detailed Description

Pulley joint definition.

The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant.

Note
The force transmitted is scaled by the ratio.
Warning
the pulley joint can get a bit squirrelly by itself. They often work better when combined with prismatic joints. You should also cover the the anchor points with static shapes to prevent one side from going to zero length.
See also
Joint, World::CreateJoint

Constructor & Destructor Documentation

◆ PulleyJointConf()

playrho::d2::PulleyJointConf::PulleyJointConf ( BodyID  bA,
BodyID  bB,
const Length2 gaA = DefaultGroundAnchorA,
const Length2 gaB = DefaultGroundAnchorB,
const Length2 laA = DefaultLocalAnchorA,
const Length2 laB = DefaultLocalAnchorB,
Length  lA = 0_m,
Length  lB = 0_m 
)

Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.

Postcondition
bodyA will have the value of bA.
bodyB will have the value of bB.
groundAnchorA will have the value of gaA.
groundAnchorB will have the value of gaB.
localAnchorA will have the value of laA.
localAnchorB will have the value of laB.
lengthA will have the value of lA.
lengthB will have the value of lB.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( PulleyJointConf object,
const Span< 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.
Parameters
objectConfiguration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID.
bodiesContainer of body constraints.
stepConfiguration for the step.
confConstraint solver configuration.
Exceptions
std::out_of_rangeIf the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container.
See also
SolveVelocity.

◆ SolvePosition()

bool SolvePosition ( const PulleyJointConf object,
const Span< BodyConstraint > &  bodies,
const ConstraintSolverConf conf 
)
related

Solves the position constraint.

Parameters
objectConfiguration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID.
bodiesContainer of body constraints.
confConstraint solver configuration.
Exceptions
std::out_of_rangeIf the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container.
Returns
true if the position errors are within tolerance.

◆ SolveVelocity()

bool SolveVelocity ( PulleyJointConf object,
const Span< BodyConstraint > &  bodies,
const StepConf step 
)
related

Solves velocity constraint.

Precondition
InitVelocity has been called.
Parameters
objectConfiguration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID.
bodiesContainer of body constraints.
stepConfiguration for the step.
Exceptions
std::out_of_rangeIf the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container.
See also
InitVelocity.
Returns
true if velocity is "solved", false otherwise.

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