Distance joint definition. More...
#include <playrho/d2/DistanceJointConf.hpp>
Public Types | |
| using | super = JointBuilder< DistanceJointConf > |
| Super type. | |
Public Types inherited from playrho::d2::JointBuilder< DistanceJointConf > | |
| using | reference = value_type & |
| Reference type. | |
| using | value_type = DistanceJointConf |
| Value type. | |
Public Member Functions | |
| constexpr | DistanceJointConf () noexcept=default |
| Default constructor. | |
| DistanceJointConf (BodyID bA, BodyID bB, const Length2 &laA=Length2{}, const Length2 &laB=Length2{}, Length l=1_m) noexcept | |
| Initializing constructor. More... | |
| constexpr auto & | UseDampingRatio (Real v) noexcept |
| Uses the given damping ratio. | |
| constexpr auto & | UseFrequency (NonNegative< Frequency > v) noexcept |
| Uses the given frequency. | |
| constexpr auto & | UseLength (Length v) noexcept |
| Uses the given length. More... | |
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 | |
| LinearVelocity | bias = {} |
| Bias. | |
| Real | dampingRatio = 0 |
| Damping ratio. More... | |
| NonNegative< Frequency > | frequency = DefaultFrequency |
| Mass-spring-damper frequency. More... | |
| Momentum | impulse = 0_Ns |
| Impulse. | |
| InvMass | invGamma = {} |
| Inverse gamma. | |
| Length | length = 1_m |
| Natural length between the anchor points. | |
| Length2 | localAnchorA = Length2{} |
| Local anchor point relative to body A's origin. | |
| Length2 | localAnchorB = Length2{} |
| Local anchor point relative to body B's origin. | |
| Mass | mass = 0_kg |
| Mass. | |
| Length2 | rA = {} |
| Relative A position. | |
| Length2 | rB = {} |
| Relative B position. | |
| UnitVec | u |
| "u" directional. | |
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 auto | DefaultFrequency = NonNegativeFF<Frequency>(0_Hz) |
| Default frequency. | |
Related Functions | |
(Note that these are not member functions.) | |
| constexpr AngularMomentum | GetAngularReaction (const DistanceJointConf &) noexcept |
| Gets the current angular reaction for the given configuration. | |
| constexpr auto | GetLength (const DistanceJointConf &object) noexcept |
| Free function for getting the length value of the given configuration. | |
| constexpr Momentum2 | GetLinearReaction (const DistanceJointConf &object) noexcept |
| Gets the current linear reaction for the given configuration. | |
| void | InitVelocity (DistanceJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
| Initializes velocity constraint data based on the given solver data. More... | |
| constexpr void | SetDampingRatio (DistanceJointConf &object, Real value) noexcept |
| Free function for setting the damping ratio value of the given configuration. | |
| constexpr void | SetFrequency (DistanceJointConf &object, NonNegative< Frequency > value) noexcept |
| Free function for setting the frequency value of the given configuration. | |
| constexpr auto | SetLength (DistanceJointConf &object, Length value) noexcept |
| Free function for setting the length value of the given configuration. | |
| constexpr bool | ShiftOrigin (DistanceJointConf &, Length2) noexcept |
| Shifts the origin notion of the given configuration. | |
| bool | SolvePosition (const DistanceJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
| Solves the position constraint. More... | |
| bool | SolveVelocity (DistanceJointConf &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. | |
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. | 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. | Real playrho::d2::DistanceJointConf::dampingRatio = 0 |
| NonNegative<Frequency> playrho::d2::DistanceJointConf::frequency = DefaultFrequency |