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

Target joint definition. More...

#include <TargetJointConf.hpp>

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

Public Types

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

Public Member Functions

constexpr TargetJointConf ()=default
 Default constructor.
 
constexpr TargetJointConf (BodyID b) noexcept
 Initializing constructor.
 
constexpr auto & UseTarget (Length2 v) noexcept
 Use value for target.
 
constexpr auto & UseAnchor (Length2 v) noexcept
 Use value for the "anchor" (in coordinates local to "body B"). More...
 
constexpr auto & UseMaxForce (NonNegative< Force > v) noexcept
 Use value for max force.
 
constexpr auto & UseFrequency (NonNegative< Frequency > v) noexcept
 Use value for frequency.
 
constexpr auto & UseDampingRatio (NonNegative< Real > v) noexcept
 Use value for damping ratio.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< TargetJointConf >
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 target = Length2{}
 The initial world target point. This is assumed to coincide with the body anchor initially.
 
Length2 localAnchorB = Length2{}
 Anchor point.
 
NonNegative< ForcemaxForce {}
 Max force. More...
 
NonNegative< Frequencyfrequency = NonNegative<Frequency>(5_Hz)
 Frequency. More...
 
NonNegative< RealdampingRatio = NonNegative<Real>(0.7f)
 The damping ratio. 0 = no damping, 1 = critical damping.
 
InvMass gamma = InvMass{0}
 Gamma.
 
Momentum2 impulse = Momentum2{}
 Impulse.
 
Length2 rB = {}
 Relative B.
 
Mass22 mass = {}
 2-by-2 mass matrix in kilograms.
 
LinearVelocity2 C = {}
 Velocity constant.
 
- 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 auto GetLocalAnchorA (const TargetJointConf &) noexcept
 Gets the local anchar A for the given configuration.
 
constexpr Momentum2 GetLinearReaction (const TargetJointConf &object)
 Gets the current linear reaction of the given configuration.
 
constexpr AngularMomentum GetAngularReaction (const TargetJointConf &)
 Gets the current angular reaction of the given configuration.
 
constexpr bool ShiftOrigin (TargetJointConf &object, Length2 newOrigin)
 Shifts the origin notion of the given configuration.
 
constexpr auto GetTarget (const TargetJointConf &object) noexcept
 Free function for getting the target value of the given configuration.
 
Mass22 GetEffectiveMassMatrix (const TargetJointConf &object, const BodyConstraint &body) noexcept
 Gets the effective mass matrix for the given configuration and body information.
 
void InitVelocity (TargetJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
bool SolveVelocity (TargetJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 
bool SolvePosition (const TargetJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
constexpr void SetTarget (TargetJointConf &object, Length2 value) noexcept
 Free function for setting the target value of the given configuration.
 
constexpr auto GetMaxForce (const TargetJointConf &object) noexcept
 Free function for getting the maximum force value of the given configuration.
 
constexpr auto SetMaxForce (TargetJointConf &object, NonNegative< Force > value) noexcept
 Free function for setting the maximum force value of the given configuration.
 
constexpr void SetFrequency (TargetJointConf &object, NonNegative< Frequency > value) noexcept
 Free function for setting the frequency value of the given configuration.
 
constexpr void SetDampingRatio (TargetJointConf &object, Real value) noexcept
 Free function for setting the damping ratio value of the given configuration.
 

Detailed Description

Target joint definition.

A target joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.

See also
Joint, World::CreateJoint
Examples
TargetJoint.cpp, and World.cpp.

Member Function Documentation

◆ UseAnchor()

constexpr auto& playrho::d2::TargetJointConf::UseAnchor ( Length2  v)
inlineconstexprnoexcept

Use value for the "anchor" (in coordinates local to "body B").

Note
Typically this would be the value of: bodyB ? InverseTransform(target, bodyB->GetTransformation()) : GetInvalid<Length2>().

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( TargetJointConf 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 TargetJointConf 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 ( TargetJointConf 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

◆ frequency

NonNegative<Frequency> playrho::d2::TargetJointConf::frequency = NonNegative<Frequency>(5_Hz)

Frequency.

The has to do with the response speed.

Note
This value may not be negative.
Examples
TargetJoint.cpp.

Referenced by UseFrequency().

◆ maxForce

NonNegative<Force> playrho::d2::TargetJointConf::maxForce {}

Max force.

The maximum constraint force that can be exerted to move the candidate body. Usually you will express as some multiple of the weight (multiplier * mass * gravity).

Note
This may not be negative.
Examples
TargetJoint.cpp, and World.cpp.

Referenced by UseMaxForce().


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