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

Friction joint definition. More...

#include <playrho/d2/FrictionJointConf.hpp>

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

Public Types

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

Public Member Functions

constexpr FrictionJointConf () noexcept=default
 Default constructor.
 
 FrictionJointConf (BodyID bA, BodyID bB, const Length2 &laA=Length2{}, const Length2 &laB=Length2{}) noexcept
 Initializing constructor. More...
 
constexpr auto & UseMaxForce (NonNegative< Force > v) noexcept
 Uses the given maximum force value.
 
constexpr auto & UseMaxTorque (NonNegative< Torque > v) noexcept
 Uses the given maximum torque value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< FrictionJointConf >
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

AngularMomentum angularImpulse = AngularMomentum{}
 Angular impulse.
 
RotInertia angularMass = {}
 Angular mass.
 
Momentum2 linearImpulse = Momentum2{}
 Linear impulse.
 
Mass22 linearMass = {}
 2-by-2 linear mass matrix in kilograms.
 
Length2 localAnchorA = Length2{}
 Local anchor point relative to body A's origin.
 
Length2 localAnchorB = Length2{}
 Local anchor point relative to body B's origin.
 
NonNegative< ForcemaxForce = DefaultMaxForce
 Maximum friction force.
 
NonNegative< TorquemaxTorque = DefaultMaxTorque
 Maximum friction torque.
 
Length2 rA = {}
 Relative A.
 
Length2 rB = {}
 Relative B.
 
- 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 DefaultMaxForce = NonNegativeFF<Force>(0_N)
 Default max force.
 
static constexpr auto DefaultMaxTorque = NonNegativeFF<Torque>(0_Nm)
 Default max torque.
 

Related Functions

(Note that these are not member functions.)

constexpr AngularMomentum GetAngularReaction (const FrictionJointConf &object) noexcept
 Gets the current angular reaction for the given configuration.
 
constexpr Momentum2 GetLinearReaction (const FrictionJointConf &object) noexcept
 Gets the current linear reaction for the given configuration.
 
constexpr auto GetMaxForce (const FrictionJointConf &object) noexcept
 Free function for getting the max force value of the given configuration.
 
constexpr auto GetMaxTorque (const FrictionJointConf &object) noexcept
 Free function for getting the max torque value of the given configuration.
 
void InitVelocity (FrictionJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
constexpr void SetMaxForce (FrictionJointConf &object, NonNegative< Force > value) noexcept
 Free function for setting the max force value of the given configuration.
 
constexpr auto SetMaxTorque (FrictionJointConf &object, NonNegative< Torque > value) noexcept
 Free function for setting the max force value of the given configuration.
 
constexpr bool ShiftOrigin (FrictionJointConf &, Length2) noexcept
 Shifts the origin notion of the given configuration.
 
bool SolvePosition (const FrictionJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
bool SolveVelocity (FrictionJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 

Detailed Description

Friction joint definition.

This is used for top-down friction. It provides 2-D translational friction and angular friction.

See also
Joint, World::CreateJoint

Constructor & Destructor Documentation

◆ FrictionJointConf()

playrho::d2::FrictionJointConf::FrictionJointConf ( BodyID  bA,
BodyID  bB,
const Length2 laA = Length2{},
const Length2 laB = Length2{} 
)
noexcept

Initializing constructor.

Initialize the bodies and local anchors.

Postcondition
bodyA will hold the value of bA.
bodyB will hold the value of bB.
localAnchorA will hold the value of laA.
localAnchorB will hold the value of laB.
All other member variables will be zero initialized.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( FrictionJointConf 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 FrictionJointConf object,
const Span< BodyConstraint > &  bodies,
const ConstraintSolverConf conf 
)
related

Solves the position constraint.

Note
This is a no-op and always returns true.
Returns
true.

◆ SolveVelocity()

bool SolveVelocity ( FrictionJointConf 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 files: