#include <VelocityConstraint.hpp>
Classes | |
struct | Conf |
Configuration data for velocity constraints. More... | |
struct | Point |
Velocity constraint point. More... | |
Public Types | |
using | size_type = std::remove_const< decltype(MaxManifoldPoints)>::type |
Size type. More... | |
Public Member Functions | |
VelocityConstraint ()=default | |
VelocityConstraint (const VelocityConstraint ©)=default | |
Copy constructor. More... | |
VelocityConstraint & | operator= (const VelocityConstraint ©)=default |
Assignment operator. More... | |
VelocityConstraint (Real friction, Real restitution, LinearVelocity tangentSpeed, const WorldManifold &worldManifold, BodyConstraint &bA, BodyConstraint &bB, Conf conf=GetDefaultConf()) | |
Initializing constructor. More... | |
UnitVec | GetNormal () const noexcept |
UnitVec | GetTangent () const noexcept |
Gets the tangent. More... | |
size_type | GetPointCount () const noexcept |
InvMass22 | GetK () const noexcept |
Mass22 | GetNormalMass () const noexcept |
Real | GetFriction () const noexcept |
Gets the combined friction of the associated contact. More... | |
Real | GetRestitution () const noexcept |
Gets the combined restitution of the associated contact. More... | |
LinearVelocity | GetTangentSpeed () const noexcept |
Gets the tangent speed of the associated contact. More... | |
BodyConstraint * | GetBodyA () const noexcept |
Gets body A. More... | |
BodyConstraint * | GetBodyB () const noexcept |
Gets body B. More... | |
Momentum | GetNormalImpulseAtPoint (size_type index) const noexcept |
Momentum | GetTangentImpulseAtPoint (size_type index) const noexcept |
LinearVelocity | GetVelocityBiasAtPoint (size_type index) const noexcept |
Mass | GetNormalMassAtPoint (size_type index) const noexcept |
Mass | GetTangentMassAtPoint (size_type index) const noexcept |
Length2 | GetPointRelPosA (size_type index) const noexcept |
Length2 | GetPointRelPosB (size_type index) const noexcept |
void | SetNormalImpulseAtPoint (size_type index, Momentum value) |
Sets the normal impulse at the given point. More... | |
void | SetTangentImpulseAtPoint (size_type index, Momentum value) |
Sets the tangent impulse at the given point. More... | |
const Point & | GetPointAt (size_type index) const |
Accesses the point identified by the given index. More... | |
Static Public Member Functions | |
static PLAYRHO_CONSTEXPR Conf | GetDefaultConf () noexcept |
Gets the default configuration for a VelocityConstraint . More... | |
Detailed Description
Contact velocity constraint.
- Note
- A valid contact velocity constraint must have a point count of either 1 or 2.
- This data structure is 136-bytes large (on at least one 64-bit platform).
- Invariant
- The "K" value cannot be changed independent of: the total inverse mass, the normal, and the point relative positions.
- The normal mass cannot be changed independent of: the "K" value.
- The velocity biases cannot be changed independent of: the normal, and the point relative positions.
Definition at line 45 of file VelocityConstraint.hpp.
Member Typedef Documentation
◆ size_type
using playrho::d2::VelocityConstraint::size_type = std::remove_const<decltype(MaxManifoldPoints)>::type |
Size type.
Definition at line 50 of file VelocityConstraint.hpp.
Constructor & Destructor Documentation
◆ VelocityConstraint() [1/3]
|
default |
Default constructor.
Initializes object with: a zero point count, an invalid K, an invalid normal mass, an invalid normal, invalid friction, invalid restitution, an invalid tangent speed.
◆ VelocityConstraint() [2/3]
|
default |
Copy constructor.
◆ VelocityConstraint() [3/3]
playrho::d2::VelocityConstraint::VelocityConstraint | ( | Real | friction, |
Real | restitution, | ||
LinearVelocity | tangentSpeed, | ||
const WorldManifold & | worldManifold, | ||
BodyConstraint & | bA, | ||
BodyConstraint & | bB, | ||
Conf | conf = GetDefaultConf() |
||
) |
Initializing constructor.
Definition at line 75 of file VelocityConstraint.cpp.
Member Function Documentation
◆ GetDefaultConf()
|
inlinestaticnoexcept |
Gets the default configuration for a VelocityConstraint
.
Definition at line 61 of file VelocityConstraint.hpp.
◆ operator=()
|
default |
Assignment operator.
◆ GetNormal()
|
inlinenoexcept |
Gets the normal of the contact in world coordinates.
- Note
- This value is set on construction.
- Returns
- Contact normal (in world coordinates) if previously set, an invalid value otherwise.
Definition at line 89 of file VelocityConstraint.hpp.
◆ GetTangent()
|
inlinenoexcept |
Gets the tangent.
Definition at line 92 of file VelocityConstraint.hpp.
◆ GetPointCount()
|
inlinenoexcept |
Gets the count of points added to this object.
- Returns
- Value between 0 and
MaxManifoldPoints
.
- See also
- MaxManifoldPoints.
- AddPoint.
Definition at line 98 of file VelocityConstraint.hpp.
◆ GetK()
|
inlinenoexcept |
Gets the "K" value.
- Note
- This value is only valid if previously set to a valid value.
- Returns
- "K" value previously set or the zero initialized value.
Definition at line 301 of file VelocityConstraint.hpp.
◆ GetNormalMass()
|
inlinenoexcept |
Gets the normal mass.
- Note
- This value is only valid if previously set.
- Returns
- normal mass previously set or the zero initialized value.
Definition at line 309 of file VelocityConstraint.hpp.
◆ GetFriction()
|
inlinenoexcept |
Gets the combined friction of the associated contact.
Definition at line 111 of file VelocityConstraint.hpp.
◆ GetRestitution()
|
inlinenoexcept |
Gets the combined restitution of the associated contact.
Definition at line 114 of file VelocityConstraint.hpp.
◆ GetTangentSpeed()
|
inlinenoexcept |
Gets the tangent speed of the associated contact.
Definition at line 117 of file VelocityConstraint.hpp.
◆ GetBodyA()
|
inlinenoexcept |
Gets body A.
Definition at line 120 of file VelocityConstraint.hpp.
◆ GetBodyB()
|
inlinenoexcept |
Gets body B.
Definition at line 123 of file VelocityConstraint.hpp.
◆ GetNormalImpulseAtPoint()
|
inlinenoexcept |
Gets the normal impulse at the given point.
- Note
- Call the
AddPoint
orSetNormalImpulseAtPoint
method to set this value.
- Returns
- Value previously set, or an invalid value.
- See also
- SetNormalImpulseAtPoint.
Definition at line 342 of file VelocityConstraint.hpp.
◆ GetTangentImpulseAtPoint()
|
inlinenoexcept |
Gets the tangent impulse at the given point.
- Note
- Call the
AddPoint
orSetTangentImpulseAtPoint
method to set this value.
- Returns
- Value previously set, or an invalid value.
- See also
- SetTangentImpulseAtPoint.
Definition at line 347 of file VelocityConstraint.hpp.
◆ GetVelocityBiasAtPoint()
|
inlinenoexcept |
Gets the velocity bias at the given point.
- Note
- The
AddPoint
method sets this value.
- Returns
- Previously set value or an invalid value.
Definition at line 327 of file VelocityConstraint.hpp.
◆ GetNormalMassAtPoint()
|
inlinenoexcept |
Gets the normal mass at the given point.
- Note
- This value depends on the values of: the sum of the inverse-masses of the two bodies, the bodies' inverse-rotational-inertia, the point-relative A and B positions, and the normal.
-
The
AddPoint
method sets this value.
Definition at line 332 of file VelocityConstraint.hpp.
◆ GetTangentMassAtPoint()
|
inlinenoexcept |
Gets the tangent mass at the given point.
- Note
- This value depends on the values of: the sum of the inverse-masses of the two bodies, the bodies' inverse-rotational-inertia, the point-relative A and B positions, and the tangent.
-
The
AddPoint
method sets this value.
Definition at line 337 of file VelocityConstraint.hpp.
◆ GetPointRelPosA()
|
inlinenoexcept |
Gets the point relative position of A.
- Note
- The
AddPoint
method sets this value.
- Returns
- Previously set value or an invalid value.
Definition at line 317 of file VelocityConstraint.hpp.
◆ GetPointRelPosB()
|
inlinenoexcept |
Gets the point relative position of B.
- Note
- The
AddPoint
method sets this value.
- Returns
- Previously set value or an invalid value.
Definition at line 322 of file VelocityConstraint.hpp.
◆ SetNormalImpulseAtPoint()
|
inline |
Sets the normal impulse at the given point.
Definition at line 352 of file VelocityConstraint.hpp.
◆ SetTangentImpulseAtPoint()
|
inline |
Sets the tangent impulse at the given point.
Definition at line 357 of file VelocityConstraint.hpp.
◆ GetPointAt()
Accesses the point identified by the given index.
- Warning
- Behavior is undefined if given index is not less than
MaxManifoldPoints
.
- Parameters
-
index Index of the point to return. This should be a value less than returned by GetPointCount
.
- Returns
- velocity constraint point for the given index. This point's data will be invalid unless previously added and set.
- See also
- GetPointCount.
Definition at line 224 of file VelocityConstraint.hpp.
The documentation for this class was generated from the following files:
- Dynamics/Contacts/VelocityConstraint.hpp
- Dynamics/Contacts/VelocityConstraint.cpp