Pulley joint definition. More...
#include <playrho/d2/PulleyJointConf.hpp>
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... | |
Related Functions inherited from playrho::d2::JointConf | |
void | Set (JointConf &def, const Joint &joint) noexcept |
Sets the joint definition data for the given joint. | |
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
.
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.
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
.
|
related |
Initializes velocity constraint data based on the given solver data.
SolveVelocity
. object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
step | Configuration for the step. |
conf | Constraint solver configuration. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
|
related |
Solves the position constraint.
object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
conf | Constraint solver configuration. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
true
if the position errors are within tolerance.
|
related |
Solves velocity constraint.
InitVelocity
has been called. object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
step | Configuration for the step. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
true
if velocity is "solved", false
otherwise.