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

Motor joint definition. More...

#include <playrho/d2/MotorJointConf.hpp>

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

Public Types

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

Public Member Functions

constexpr MotorJointConf () noexcept=default
 Default constructor.
 
 MotorJointConf (BodyID bA, BodyID bB, const Length2 &lo=Length2{}, Angle ao=0_deg) noexcept
 Initialize the bodies and offsets using the current transforms.
 
constexpr auto & UseAngularOffset (Angle v) noexcept
 Uses the given angular offset value.
 
constexpr auto & UseCorrectionFactor (Real v) noexcept
 Uses the given correction factor.
 
constexpr auto & UseLinearOffset (const Length2 &v) noexcept
 Uses the given linear offset value.
 
constexpr auto & UseMaxForce (NonNegative< Force > v) noexcept
 Uses the given maximum force value.
 
constexpr auto & UseMaxTorque (NonNegative< Torque > v) noexcept
 Uses the given max torque value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< MotorJointConf >
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

Angle angularError = 0_deg
 Angular error.
 
AngularMomentum angularImpulse {}
 Angular impulse.
 
RotInertia angularMass = {}
 Angular mass.
 
Angle angularOffset = 0_deg
 Angle of body-B minus angle of body-A.
 
Real correctionFactor = DefaultCorrectionFactor
 Position correction factor in the range [0,1].
 
Length2 linearError {}
 Linear error.
 
Momentum2 linearImpulse {}
 Linear impulse.
 
Mass22 linearMass = {}
 2-by-2 linear mass matrix in kilograms.
 
Length2 linearOffset = Length2{}
 Position of body-B minus the position of body-A, in body-A's frame.
 
NonNegative< ForcemaxForce = DefaultMaxForce
 Maximum motor force.
 
NonNegative< TorquemaxTorque = DefaultMaxTorque
 Maximum motor 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 DefaultCorrectionFactor = Real(0.3)
 Default correction factor.
 
static constexpr auto DefaultMaxForce = NonNegativeFF<Force>(1_N)
 Default max force.
 
static constexpr auto DefaultMaxTorque = NonNegativeFF<Torque>(1_Nm)
 Default max torque.
 

Related Functions

(Note that these are not member functions.)

constexpr auto GetAngularError (const MotorJointConf &object) noexcept
 Free function for getting the angular error value of the given configuration.
 
constexpr auto GetAngularOffset (const MotorJointConf &object) noexcept
 Free function for getting the angular offset value of the given configuration.
 
constexpr auto GetCorrectionFactor (const MotorJointConf &object) noexcept
 Free function for getting the correction factor value of the given configuration.
 
constexpr auto GetLinearError (const MotorJointConf &object) noexcept
 Free function for getting the linear error value of the given configuration.
 
constexpr auto GetLinearOffset (const MotorJointConf &object) noexcept
 Free function for getting the linear offset value of the given configuration.
 
constexpr auto GetLocalAnchorA (const MotorJointConf &) noexcept
 Gets the local anchor A.
 
constexpr auto GetLocalAnchorB (const MotorJointConf &) noexcept
 Gets the local anchor B.
 
constexpr auto GetMaxForce (const MotorJointConf &object) noexcept
 Free function for getting the maximum force value of the given configuration.
 
constexpr auto GetMaxTorque (const MotorJointConf &object) noexcept
 Free function for getting the maximum torque value of the given configuration.
 
void InitVelocity (MotorJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
constexpr auto SetAngularOffset (MotorJointConf &object, Angle value) noexcept
 Free function for setting the angular offset value of the given configuration.
 
constexpr auto SetCorrectionFactor (MotorJointConf &object, Real value) noexcept
 Free function for setting the correction factor value of the given configuration.
 
constexpr auto SetLinearOffset (MotorJointConf &object, const Length2 &value) noexcept
 Free function for setting the linear offset value of the given configuration.
 
constexpr auto SetMaxForce (MotorJointConf &object, NonNegative< Force > value) noexcept
 Free function for setting the maximum force value of the given configuration.
 
constexpr auto SetMaxTorque (MotorJointConf &object, NonNegative< Torque > value) noexcept
 Free function for setting the maximum torque value of the given configuration.
 
constexpr auto ShiftOrigin (MotorJointConf &, const Length2 &) noexcept
 Shifts the origin notion of the given configuration.
 
bool SolvePosition (const MotorJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
bool SolveVelocity (MotorJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 

Detailed Description

Motor joint definition.

A motor joint is used to control the relative motion between two bodies. A typical usage is to control the movement of a dynamic body with respect to the ground.

See also
Joint, World::CreateJoint

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( MotorJointConf 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 MotorJointConf 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 ( MotorJointConf 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: