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

Weld joint definition. More...

#include <playrho/d2/WeldJointConf.hpp>

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

Public Types

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

Public Member Functions

constexpr WeldJointConf () noexcept=default
 Default constructor.
 
 WeldJointConf (BodyID bA, BodyID bB, const Length2 &laA=Length2{}, const Length2 &laB=Length2{}, Angle ra=0_deg) 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 value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< WeldJointConf >
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

AngularVelocity bias = {}
 Bias.
 
Real dampingRatio = 0
 Damping ratio. More...
 
NonNegative< Frequencyfrequency = DefaultFrequency
 Mass-spring-damper frequency. More...
 
InvRotInertia gamma = {}
 Gamma.
 
Vec3 impulse = Vec3{}
 Impulse.
 
Length2 localAnchorA = Length2{}
 The local anchor point relative to body A's origin.
 
Length2 localAnchorB = Length2{}
 The local anchor point relative to body B's origin.
 
Mat33 mass = {}
 Mass.
 
Length2 rA = {}
 Relative A.
 
Length2 rB = {}
 Relative B.
 
Angle referenceAngle = 0_deg
 The body-B angle minus body-A angle in the reference state (radians).
 
- 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 WeldJointConf &object) noexcept
 Gets the current angular reaction of the given configuration.
 
constexpr Momentum2 GetLinearReaction (const WeldJointConf &object) noexcept
 Gets the current linear reaction of the given configuration.
 
void InitVelocity (WeldJointConf &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 (WeldJointConf &object, Real value) noexcept
 Free function for setting the damping ratio of the given configuration.
 
constexpr void SetFrequency (WeldJointConf &object, NonNegative< Frequency > value) noexcept
 Free function for setting the frequency of the given configuration.
 
constexpr auto ShiftOrigin (WeldJointConf &, const Length2 &) noexcept
 Shifts the origin notion of the given configuration.
 
bool SolvePosition (const WeldJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
bool SolveVelocity (WeldJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 

Detailed Description

Weld joint definition.

Note
A weld joint essentially glues two bodies together. A weld joint may distort somewhat because the island constraint solver is approximate.
You need to specify local anchor points where they are attached and the relative body angle.
The position of the anchor points is important for computing the reaction torque.
See also
Joint, World::CreateJoint

Constructor & Destructor Documentation

◆ WeldJointConf()

playrho::d2::WeldJointConf::WeldJointConf ( BodyID  bA,
BodyID  bB,
const Length2 laA = Length2{},
const Length2 laB = Length2{},
Angle  ra = 0_deg 
)
noexcept

Initializing constructor.

Initializes the bodies, anchors, and reference angle using a world anchor point.

Parameters
bAIdentifier of body A.
bBIdentifier of body B.
laALocal anchor A location in world coordinates.
laBLocal anchor B location in world coordinates.
raReference angle.
Postcondition
bodyA will have the value of bA.
bodyB will have the value of bB.
localAnchorA will have the value of laA.
localAnchorB will have the value of laB.
referenceAngle will have the value of ra.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( WeldJointConf 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 WeldJointConf 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 ( WeldJointConf 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.

Member Data Documentation

◆ dampingRatio

Real playrho::d2::WeldJointConf::dampingRatio = 0

Damping ratio.

Note
0 = no damping, 1 = critical damping.

Referenced by UseDampingRatio().

◆ frequency

NonNegative<Frequency> playrho::d2::WeldJointConf::frequency = DefaultFrequency

Mass-spring-damper frequency.

Note
Rotation only.
Disable softness with a value of 0.

Referenced by UseFrequency().


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