Prismatic joint definition. More...
#include <playrho/d2/PrismaticJointConf.hpp>
Public Types | |
using | super = JointBuilder< PrismaticJointConf > |
Super type. | |
Public Types inherited from playrho::d2::JointBuilder< PrismaticJointConf > | |
using | reference = value_type & |
Reference type. | |
using | value_type = PrismaticJointConf |
Value type. | |
Public Member Functions | |
constexpr | PrismaticJointConf () noexcept=default |
Default constructor. | |
PrismaticJointConf (BodyID bA, BodyID bB, const Length2 &laA=Length2{}, const Length2 &laB=Length2{}, const UnitVec &axisA=UnitVec::GetRight(), Angle angle=0_deg) noexcept | |
Initializing constructor. More... | |
constexpr auto & | UseEnableLimit (bool v) noexcept |
Uses the given enable limit state value. | |
constexpr auto & | UseEnableMotor (bool v) noexcept |
Uses the given enable motor state value. | |
constexpr auto & | UseLowerLength (Length v) noexcept |
Uses the given lower translation value. | |
constexpr auto & | UseMaxMotorForce (Force v) noexcept |
Uses the given max motor force value. | |
constexpr auto & | UseMotorSpeed (AngularVelocity v) noexcept |
Uses the given motor speed value. | |
constexpr auto & | UseUpperLength (Length v) noexcept |
Uses the given upper translation value. | |
Public Member Functions inherited from playrho::d2::JointBuilder< PrismaticJointConf > | |
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 | |
Length | a1 = 0_m |
Location A-1. | |
Length | a2 = 0_m |
Location A-2. | |
UnitVec | axis = UnitVec::GetZero() |
Axis. | |
bool | enableLimit = false |
Enable/disable the joint limit. | |
bool | enableMotor = false |
Enable/disable the joint motor. | |
Vec3 | impulse = Vec3{} |
Impulse. | |
Mat33 | K = {} |
K matrix. | |
LimitState | limitState = LimitState::e_inactiveLimit |
Limit state. | |
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. | |
UnitVec | localXAxisA = UnitVec::GetRight() |
The local X translation unit axis in body A. | |
UnitVec | localYAxisA = GetRevPerpendicular(UnitVec::GetRight()) |
The local Y translation unit axis in body A. | |
Length | lowerTranslation = 0_m |
The lower translation limit. | |
Force | maxMotorForce = 0_N |
The maximum motor force. | |
Momentum | motorImpulse = 0_Ns |
Motor impulse. | |
Mass | motorMass = 0_kg |
Motor mass. | |
AngularVelocity | motorSpeed = 0_rpm |
The desired angular motor speed. | |
UnitVec | perp = UnitVec::GetZero() |
Perpendicular. | |
Angle | referenceAngle = 0_deg |
The constrained angle between the bodies: body B's angle minus body A's angle. | |
Length | s1 = 0_m |
Location S-1. | |
Length | s2 = 0_m |
Location S-2. | |
Length | upperTranslation = 0_m |
The upper translation limit. | |
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.) | |
AngularMomentum | GetAngularReaction (const PrismaticJointConf &conf) |
Gets the current angular reaction of the given configuration. | |
constexpr auto | GetLinearLowerLimit (const PrismaticJointConf &conf) noexcept |
Free function for getting the linear lower limit value of the given configuration. | |
Momentum2 | GetLinearReaction (const PrismaticJointConf &conf) |
Gets the current linear reaction of the given configuration. | |
constexpr auto | GetLinearUpperLimit (const PrismaticJointConf &conf) noexcept |
Free function for getting the linear upper limit value of the given configuration. | |
void | InitVelocity (PrismaticJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
Initializes velocity constraint data based on the given solver data. More... | |
constexpr void | SetLinearLimits (PrismaticJointConf &conf, Length lower, Length upper) noexcept |
Free function for setting the linear limits of the given configuration. | |
constexpr void | SetMaxMotorForce (PrismaticJointConf &object, Force value) |
Free function for setting the maximum motor torque value of the given configuration. | |
constexpr auto | ShiftOrigin (PrismaticJointConf &, const Length2 &) noexcept |
Shifts the origin notion of the given configuration. | |
bool | SolvePosition (const PrismaticJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
Solves the position constraint. More... | |
bool | SolveVelocity (PrismaticJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step) |
Solves velocity constraint. More... | |
Related Functions inherited from playrho::d2::JointConf | |
void | Set (JointConf &def, const Joint &joint) noexcept |
Sets the joint definition data for the given joint. | |
Prismatic joint definition.
This joint provides one degree of freedom: translation along an axis fixed in body-A. Relative rotation is prevented. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
|
noexcept |
Initializing constructor.
Initializes the bodies, anchors, axis, and reference angle using the world anchor and unit world axis.
|
related |
Initializes velocity constraint data based on the given solver data.
SolveVelocity
. object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
step | Configuration for the step. |
conf | Constraint solver configuration. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
|
related |
Solves the position constraint.
object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
conf | Constraint solver configuration. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
true
if the position errors are within tolerance.
|
related |
Solves velocity constraint.
InitVelocity
has been called. object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
step | Configuration for the step. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
true
if velocity is "solved", false
otherwise.