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

Rope joint definition. More...

#include <playrho/d2/RopeJointConf.hpp>

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

Public Types

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

Public Member Functions

constexpr RopeJointConf () noexcept=default
 Default constructor.
 
constexpr RopeJointConf (BodyID bA, BodyID bB) noexcept
 Initializing constructor.
 
constexpr auto & UseMaxLength (Length v) noexcept
 Uses the given max length value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< RopeJointConf >
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

Momentum impulse = 0_Ns
 Impulse.
 
Length length = 0_m
 Length.
 
LimitState limitState = LimitState::e_inactiveLimit
 Limit state.
 
Length2 localAnchorA = Length2{-1_m, 0_m}
 The local anchor point relative to body A's origin.
 
Length2 localAnchorB = Length2{+1_m, 0_m}
 The local anchor point relative to body B's origin.
 
Mass mass = 0_kg
 Mass.
 
Length maxLength = 0_m
 The maximum length of the rope.
 
Length2 rA = {}
 Relative A.
 
Length2 rB = {}
 Relative B.
 
UnitVec u
 U direction.
 
- 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 AngularMomentum GetAngularReaction (const RopeJointConf &) noexcept
 Gets the current angular reaction of the given configuration.
 
constexpr Momentum2 GetLinearReaction (const RopeJointConf &object) noexcept
 Gets the current linear reaction of the given configuration.
 
constexpr auto GetMaxLength (const RopeJointConf &object) noexcept
 Free function for getting the maximum length value of the given configuration.
 
void InitVelocity (RopeJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
constexpr auto SetMaxLength (RopeJointConf &object, Length value) noexcept
 Free function for setting the maximum length value of the given configuration.
 
constexpr auto ShiftOrigin (RopeJointConf &, const Length2 &) noexcept
 Shifts the origin notion of the given configuration.
 
bool SolvePosition (const RopeJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
bool SolveVelocity (RopeJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 

Detailed Description

Rope joint definition.

A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. This requires two body anchor points and a maximum lengths.

Note
By default the connected objects will not collide.
Warning
If you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so it was decided not to implement it that way. See DistanceJoint if you want to dynamically control length.
See also
collideConnected in JointConf.
Joint, World::CreateJoint

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( RopeJointConf 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 RopeJointConf 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 ( RopeJointConf 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 file: