playrho::d2::DistanceJointConf Struct Reference

Distance joint definition. More...

#include <DistanceJointConf.hpp>

Public Types

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

Public Member Functions

PLAYRHO_CONSTEXPR DistanceJointConf () noexcept
 
 DistanceJointConf (const DistanceJointConf &copy)=default
 Copy constructor. More...
 
 DistanceJointConf (NonNull< Body * > bodyA, NonNull< Body * > bodyB, Length2 anchorA=Length2{}, Length2 anchorB=Length2{}) noexcept
 Initializing constructor. More...
 
PLAYRHO_CONSTEXPR DistanceJointConfUseLength (Length v) noexcept
 Uses the given length. More...
 
PLAYRHO_CONSTEXPR DistanceJointConfUseFrequency (NonNegative< Frequency > v) noexcept
 Uses the given frequency. More...
 
PLAYRHO_CONSTEXPR DistanceJointConfUseDampingRatio (Real v) noexcept
 Uses the given damping ratio. More...
 
- Public Member Functions inherited from playrho::d2::JointBuilder< DistanceJointConf >
PLAYRHO_CONSTEXPR JointBuilder (JointType t) noexcept
 Initializing constructor. More...
 
PLAYRHO_CONSTEXPR reference UseBodyA (Body *b) noexcept
 Use value for body A setting. More...
 
PLAYRHO_CONSTEXPR reference UseBodyB (Body *b) noexcept
 Use value for body B setting. More...
 
PLAYRHO_CONSTEXPR reference UseCollideConnected (bool v) noexcept
 Use value for collide connected setting. More...
 
PLAYRHO_CONSTEXPR reference UseUserData (void *v) noexcept
 Use value for user data setting. More...
 
- Public Member Functions inherited from playrho::d2::JointConf
 JointConf ()=delete
 Deleted default constructor for abstract base class. More...
 
PLAYRHO_CONSTEXPR JointConf (JointType t) noexcept
 Initializing constructor. More...
 

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< Frequencyfrequency = NonNegative<Frequency>{0_Hz}
 Mass-spring-damper frequency. More...
 
Real dampingRatio = 0
 Damping ratio. More...
 
- Public Attributes inherited from playrho::d2::JointConf
JointType type = JointType::Unknown
 Type of the joint is set automatically for concrete joint types. More...
 
BodybodyA = nullptr
 1st attached body. More...
 
BodybodyB = nullptr
 2nd attached body. More...
 
bool collideConnected = false
 Collide connected. More...
 
void * userData = nullptr
 User data. More...
 

Additional Inherited Members

Detailed Description

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

Warning
Do not use a zero or short length.
Examples
World.cpp.

Definition at line 41 of file DistanceJointConf.hpp.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ DistanceJointConf() [1/3]

PLAYRHO_CONSTEXPR playrho::d2::DistanceJointConf::DistanceJointConf ( )
inlinenoexcept

Definition at line 47 of file DistanceJointConf.hpp.

◆ DistanceJointConf() [2/3]

playrho::d2::DistanceJointConf::DistanceJointConf ( const DistanceJointConf copy)
default

Copy constructor.

◆ DistanceJointConf() [3/3]

playrho::d2::DistanceJointConf::DistanceJointConf ( NonNull< Body * >  bodyA,
NonNull< Body * >  bodyB,
Length2  anchorA = Length2{},
Length2  anchorB = Length2{} 
)
noexcept

Initializing constructor.

Initialize the bodies, anchors, and length using the world anchors.

Definition at line 29 of file DistanceJointConf.cpp.

Member Function Documentation

◆ UseLength()

PLAYRHO_CONSTEXPR DistanceJointConf & playrho::d2::DistanceJointConf::UseLength ( Length  v)
inlinenoexcept

Uses the given length.

Definition at line 85 of file DistanceJointConf.hpp.

◆ UseFrequency()

PLAYRHO_CONSTEXPR DistanceJointConf & playrho::d2::DistanceJointConf::UseFrequency ( NonNegative< Frequency v)
inlinenoexcept

Uses the given frequency.

Definition at line 91 of file DistanceJointConf.hpp.

◆ UseDampingRatio()

PLAYRHO_CONSTEXPR DistanceJointConf & playrho::d2::DistanceJointConf::UseDampingRatio ( Real  v)
inlinenoexcept

Uses the given damping ratio.

Definition at line 97 of file DistanceJointConf.hpp.

Member Data Documentation

◆ localAnchorA

Length2 playrho::d2::DistanceJointConf::localAnchorA = Length2{}

Local anchor point relative to body A's origin.

Definition at line 68 of file DistanceJointConf.hpp.

◆ localAnchorB

Length2 playrho::d2::DistanceJointConf::localAnchorB = Length2{}

Local anchor point relative to body B's origin.

Definition at line 71 of file DistanceJointConf.hpp.

◆ length

Length playrho::d2::DistanceJointConf::length = 1_m

Natural length between the anchor points.

Definition at line 74 of file DistanceJointConf.hpp.

◆ frequency

NonNegative<Frequency> playrho::d2::DistanceJointConf::frequency = NonNegative<Frequency>{0_Hz}

Mass-spring-damper frequency.

Note
0 disables softness.

Definition at line 78 of file DistanceJointConf.hpp.

◆ dampingRatio

Real playrho::d2::DistanceJointConf::dampingRatio = 0

Damping ratio.

Note
0 = no damping, 1 = critical damping.

Definition at line 82 of file DistanceJointConf.hpp.


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