Gear joint definition. More...
#include <playrho/d2/GearJointConf.hpp>
Classes | |
struct | PrismaticData |
Prismatic specific data. More... | |
struct | RevoluteData |
Revolute specific data. More... | |
Public Types | |
using | super = JointBuilder< GearJointConf > |
Super type. | |
using | TypeData = std::variant< std::monostate, PrismaticData, RevoluteData > |
Type specific data type alias. | |
Public Types inherited from playrho::d2::JointBuilder< GearJointConf > | |
using | reference = value_type & |
Reference type. | |
using | value_type = GearJointConf |
Value type. | |
Public Member Functions | |
constexpr | GearJointConf () noexcept=default |
Default constructor. | |
GearJointConf (BodyID bA, BodyID bB, BodyID bC, BodyID bD) noexcept | |
Initializing constructor. | |
constexpr auto & | UseRatio (Real v) noexcept |
Uses the given ratio value. | |
Public Member Functions inherited from playrho::d2::JointBuilder< GearJointConf > | |
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 | |
BodyID | bodyC = InvalidBodyID |
Identifier of body C. | |
BodyID | bodyD = InvalidBodyID |
Identifier of body D. | |
Real | constant = Real{0} |
Constant applied with the ratio. More... | |
Momentum | impulse = 0_Ns |
Impulse. | |
Vec2 | JvAC = {} |
A-C directional data. | |
Vec2 | JvBD = {} |
B-D directional data. | |
Length | JwA = 0_m |
Data for calculating Body A velocity. | |
Length | JwB = 0_m |
Data for calculating Body B velocity. | |
Length | JwC = 0_m |
Data for calculating Body C velocity. | |
Length | JwD = 0_m |
Data for calculating Body D velocity. | |
Real | mass = 0 |
Either linear mass or angular mass. | |
Real | ratio = Real{1} |
TypeData | typeDataAC |
Data for a revolute or prismatic joint between body A & C. | |
TypeData | typeDataBD |
Data for a revolute or prismatic joint between body B & D. | |
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 AngularMomentum | GetAngularReaction (const GearJointConf &object) |
Gets the current angular reaction for the given configuration. | |
constexpr auto | GetConstant (const GearJointConf &object) noexcept |
Free function for getting the constant value of the given configuration. | |
constexpr Momentum2 | GetLinearReaction (const GearJointConf &object) |
Gets the current linear reaction for the given configuration. | |
constexpr auto | GetRatio (const GearJointConf &object) noexcept |
Free function for getting the ratio value of the given configuration. | |
TypeID | GetTypeAC (const GearJointConf &object) noexcept |
Free function for getting joint 1 type value of the given configuration. | |
TypeID | GetTypeBD (const GearJointConf &object) noexcept |
Free function for getting joint 2 type value of the given configuration. | |
void | InitVelocity (GearJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
Initializes velocity constraint data based on the given solver data. More... | |
constexpr auto | SetRatio (GearJointConf &object, Real value) noexcept |
Free function for setting the ratio value of the given configuration. | |
constexpr bool | ShiftOrigin (GearJointConf &, const Length2 &) noexcept |
Shifts the origin notion of the given configuration. | |
bool | SolvePosition (const GearJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
Solves the position constraint. More... | |
bool | SolveVelocity (GearJointConf &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. | |
Gear joint definition.
A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant
. The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length.
|
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. Constant applied with the ratio.