PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::WeldJointConf Struct Reference

Weld joint definition. More...

#include <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 value_type = WeldJointConf
 Value type.
 
using reference = value_type &
 Reference type.
 

Public Member Functions

constexpr WeldJointConf ()=default
 Default constructor.
 
 WeldJointConf (BodyID bodyA, BodyID bodyB, Length2 laA=Length2{}, Length2 laB=Length2{}, Angle ra=0_deg) noexcept
 Initializing constructor. More...
 
constexpr auto & UseFrequency (NonNegative< Frequency > v) noexcept
 Uses the given frequency value.
 
constexpr auto & UseDampingRatio (Real v) noexcept
 Uses the given damping ratio.
 
- 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

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

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
Examples
WeldJoint.cpp.

Constructor & Destructor Documentation

◆ WeldJointConf()

playrho::d2::WeldJointConf::WeldJointConf ( BodyID  bodyA,
BodyID  bodyB,
Length2  laA = Length2{},
Length2  laB = Length2{},
Angle  ra = 0_deg 
)
noexcept

Initializing constructor.

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

Parameters
bodyAIdentifier of body A.
laALocal anchor A location in world coordinates.
bodyBIdentifier of body B.
laBLocal anchor B location in world coordinates.
raReference angle.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( WeldJointConf object,
std::vector< 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.
See also
SolveVelocity.

◆ SolvePosition()

bool SolvePosition ( const WeldJointConf object,
std::vector< BodyConstraint > &  bodies,
const ConstraintSolverConf conf 
)
related

Solves the position constraint.

Returns
true if the position errors are within tolerance.

◆ SolveVelocity()

bool SolveVelocity ( WeldJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step 
)
related

Solves velocity constraint.

Precondition
InitVelocity has been called.
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.
Examples
WeldJoint.cpp.

Referenced by UseDampingRatio().

◆ frequency

NonNegative<Frequency> playrho::d2::WeldJointConf::frequency {}

Mass-spring-damper frequency.

Note
Rotation only.
Disable softness with a value of 0.
Examples
WeldJoint.cpp.

Referenced by UseFrequency().


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