Distance joint definition. More...
#include <DistanceJointConf.hpp>
Public Types | |
using | super = JointBuilder< DistanceJointConf > |
Super type. | |
Public Types inherited from playrho::d2::JointBuilder< DistanceJointConf > | |
using | value_type = DistanceJointConf |
Value type. | |
using | reference = value_type & |
Reference type. | |
Public Member Functions | |
constexpr | DistanceJointConf ()=default |
Default constructor. | |
DistanceJointConf (const DistanceJointConf ©)=default | |
Copy constructor. | |
DistanceJointConf (BodyID bA, BodyID bB, Length2 laA=Length2{}, Length2 laB=Length2{}, Length l=1_m) noexcept | |
Initializing constructor. More... | |
constexpr auto & | UseLength (Length v) noexcept |
Uses the given length. More... | |
constexpr auto & | UseFrequency (NonNegative< Frequency > v) noexcept |
Uses the given frequency. | |
constexpr auto & | UseDampingRatio (Real v) noexcept |
Uses the given damping ratio. | |
Public Member Functions inherited from playrho::d2::JointBuilder< DistanceJointConf > | |
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 | localAnchorA = Length2{} |
Local anchor point relative to body A's origin. More... | |
Length2 | localAnchorB = Length2{} |
Local anchor point relative to body B's origin. More... | |
Length | length = 1_m |
Natural length between the anchor points. More... | |
NonNegative< Frequency > | frequency {} |
Mass-spring-damper frequency. More... | |
Real | dampingRatio = 0 |
Damping ratio. More... | |
Momentum | impulse = 0_Ns |
Impulse. 4-bytes (with 4-byte Real). | |
UnitVec | u |
"u" directional. 8-bytes (with 4-byte Real). | |
Length2 | rA = {} |
Relative A position. 8-bytes (with 4-byte Real). | |
Length2 | rB = {} |
Relative B position. 8-bytes (with 4-byte Real). | |
InvMass | invGamma = {} |
Inverse gamma. 4-bytes (with 4-byte Real). | |
LinearVelocity | bias = {} |
Bias. 4-bytes (with 4-byte Real). | |
Mass | mass = 0_kg |
Mass. 4-bytes (with 4-byte Real). | |
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 DistanceJointConf &object) noexcept |
Gets the current linear reaction for the given configuration. | |
constexpr AngularMomentum | GetAngularReaction (const DistanceJointConf &) noexcept |
Gets the current angular reaction for the given configuration. | |
constexpr bool | ShiftOrigin (DistanceJointConf &, Length2) noexcept |
Shifts the origin notion of the given configuration. | |
void | InitVelocity (DistanceJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
Initializes velocity constraint data based on the given solver data. More... | |
bool | SolveVelocity (DistanceJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step) |
Solves velocity constraint. More... | |
bool | SolvePosition (const DistanceJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
Solves the position constraint. More... | |
constexpr void | SetFrequency (DistanceJointConf &object, NonNegative< Frequency > value) noexcept |
Free function for setting the frequency value of the given configuration. | |
constexpr void | SetDampingRatio (DistanceJointConf &object, Real value) noexcept |
Free function for setting the damping ratio value of the given configuration. | |
constexpr auto | GetLength (const DistanceJointConf &object) noexcept |
Free function for getting the length value of the given configuration. | |
constexpr auto | SetLength (DistanceJointConf &object, Length value) noexcept |
Free function for setting the length value of the given configuration. | |
Related Functions inherited from playrho::d2::JointConf | |
void | Set (JointConf &def, const Joint &joint) noexcept |
Sets the joint definition data for the given joint. | |
Distance joint definition.
This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.
|
noexcept |
Initializing constructor.
Initialize the bodies, anchors, and length using the world anchors.
|
inlineconstexprnoexcept |
Uses the given length.
|
related |
Initializes velocity constraint data based on the given solver data.
SolveVelocity
.
|
related |
Solves the position constraint.
true
if the position errors are within tolerance.
|
related |
Solves velocity constraint.
InitVelocity
has been called. true
if velocity is "solved", false
otherwise. Real playrho::d2::DistanceJointConf::dampingRatio = 0 |
Damping ratio.
Referenced by UseDampingRatio().
NonNegative<Frequency> playrho::d2::DistanceJointConf::frequency {} |
Mass-spring-damper frequency.
Referenced by UseFrequency().
Length playrho::d2::DistanceJointConf::length = 1_m |
Natural length between the anchor points.
Referenced by UseLength().
Local anchor point relative to body A's origin.
Local anchor point relative to body B's origin.