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

Pulley joint definition. More...

#include <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 value_type = PulleyJointConf
 Value type.
 
using reference = value_type &
 Reference type.
 

Public Member Functions

 PulleyJointConf () noexcept
 Default constructor.
 
 PulleyJointConf (BodyID bodyA, BodyID bodyB, Length2 groundAnchorA=DefaultGroundAnchorA, Length2 groundAnchorB=DefaultGroundAnchorB, Length2 anchorA=DefaultLocalAnchorA, Length2 anchorB=DefaultLocalAnchorB, Length lA=0_m, Length lB=0_m)
 Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
 
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.
 
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.
 
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.
 
Real ratio = 1
 The pulley ratio, used to simulate a block-and-tackle.
 
Momentum impulse = 0_Ns
 Impulse.
 
UnitVec uA
 Unit vector A.
 
UnitVec uB
 Unit vector B.
 
Length2 rA {}
 Relative A.
 
Length2 rB {}
 Relative B.
 
Mass mass = 0_kg
 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...
 

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 Momentum2 GetLinearReaction (const PulleyJointConf &object) noexcept
 Gets the current linear reaction of the given configuration.
 
constexpr AngularMomentum GetAngularReaction (const PulleyJointConf &) noexcept
 Gets the current angular reaction of the given configuration.
 
bool ShiftOrigin (PulleyJointConf &object, Length2 newOrigin) noexcept
 Shifts the origin notion of the given configuration.
 
void InitVelocity (PulleyJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
bool SolveVelocity (PulleyJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 
bool SolvePosition (const PulleyJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
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 auto SetRatio (PulleyJointConf &object, Real value) noexcept
 Free function for setting the ratio value of the given configuration.
 

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
Examples
PulleyJoint.cpp.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( PulleyJointConf 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 PulleyJointConf 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 ( PulleyJointConf 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.

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