The per-contact velocity constraint data structure. More...
#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. | |
Public Member Functions | |
| VelocityConstraint ()=default | |
| Default constructor. More... | |
| VelocityConstraint (const VelocityConstraint ©)=default | |
| Copy constructor. | |
| VelocityConstraint & | operator= (const VelocityConstraint ©)=default |
| Assignment operator. | |
| VelocityConstraint (Real friction, Real restitution, LinearVelocity tangentSpeed, const WorldManifold &worldManifold, BodyID bA, BodyID bB, const std::vector< BodyConstraint > &bodies, const Conf &conf=GetDefaultConf()) | |
| Initializing constructor. | |
| UnitVec | GetNormal () const noexcept |
| Gets the normal of the contact in world coordinates. More... | |
| UnitVec | GetTangent () const noexcept |
| Gets the tangent. | |
| size_type | GetPointCount () const noexcept |
| Gets the count of points added to this object. More... | |
| InvMass22 | GetK () const noexcept |
| Gets the "K" value. More... | |
| Mass22 | GetNormalMass () const noexcept |
| Gets the normal mass. More... | |
| Real | GetFriction () const noexcept |
| Gets the combined friction of the associated contact. | |
| Real | GetRestitution () const noexcept |
| Gets the combined restitution of the associated contact. | |
| LinearVelocity | GetTangentSpeed () const noexcept |
| Gets the tangent speed of the associated contact. | |
| BodyID | GetBodyA () const noexcept |
| Gets identifier of body A. | |
| BodyID | GetBodyB () const noexcept |
| Gets identifier of body B. | |
| Momentum | GetNormalImpulseAtPoint (size_type index) const noexcept |
| Gets the normal impulse at the given point. More... | |
| Momentum | GetTangentImpulseAtPoint (size_type index) const noexcept |
| Gets the tangent impulse at the given point. More... | |
| LinearVelocity | GetVelocityBiasAtPoint (size_type index) const noexcept |
| Gets the velocity bias at the given point. More... | |
| Mass | GetNormalMassAtPoint (size_type index) const noexcept |
| Gets the normal mass at the given point. More... | |
| Mass | GetTangentMassAtPoint (size_type index) const noexcept |
| Gets the tangent mass at the given point. More... | |
| Length2 | GetPointRelPosA (size_type index) const noexcept |
| Gets the point relative position of A. More... | |
| Length2 | GetPointRelPosB (size_type index) const noexcept |
| Gets the point relative position of B. More... | |
| void | SetNormalImpulseAtPoint (size_type index, Momentum value) |
| Sets the normal impulse at the given point. | |
| void | SetTangentImpulseAtPoint (size_type index, Momentum value) |
| Sets the tangent impulse at the given point. | |
| const Point & | GetPointAt (size_type index) const |
| Accesses the point identified by the given index. More... | |
Static Public Member Functions | |
| static constexpr Conf | GetDefaultConf () noexcept |
Gets the default configuration for a VelocityConstraint. | |
Private Member Functions | |
| void | AddPoint (Momentum normalImpulse, Momentum tangentImpulse, Length2 relA, Length2 relB, const std::vector< BodyConstraint > &bodies, Conf conf) |
| Adds the given point to this contact velocity constraint object. More... | |
| void | RemovePoint () noexcept |
| Removes the last point added. | |
| Point | GetPoint (Momentum normalImpulse, Momentum tangentImpulse, Length2 relA, Length2 relB, const std::vector< BodyConstraint > &bodies, Conf conf) const noexcept |
| Gets a point instance for the given parameters. | |
| Point & | PointAt (size_type index) |
| Accesses the point identified by the given index. More... | |
Private Attributes | |
| Point | m_points [MaxManifoldPoints] |
| Velocity constraint points array (at least 72-bytes). | |
| InvMass3 | m_K = InvMass3{} |
| Block solver "K" info. More... | |
| Mass3 | m_normalMass = Mass3{} |
| Normal mass information. More... | |
| BodyID | m_bodyA = InvalidBodyID |
| Identifier for body-A. | |
| BodyID | m_bodyB = InvalidBodyID |
| Identifier for body-B. | |
| UnitVec | m_normal = GetInvalid<UnitVec>() |
| Normal of the world manifold. 8-bytes. | |
| Real | m_friction = GetInvalid<Real>() |
| Friction coefficient (4-bytes). Usually in the range of [0,1]. | |
| Real | m_restitution = GetInvalid<Real>() |
| Restitution coefficient (4-bytes). | |
| LinearVelocity | m_tangentSpeed = GetInvalid<decltype(m_tangentSpeed)>() |
| Tangent speed (4-bytes). | |
| size_type | m_pointCount = 0 |
| Point count (at least 1-byte). | |
The per-contact velocity constraint data structure.
|
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.
|
private |
Adds the given point to this contact velocity constraint object.
Adds up to MaxManifoldPoints points. To find out how many points have already been added, call GetPointCount.
MaxManifoldPoints points.
|
inlinenoexcept |
Gets the "K" value.
|
inlinenoexcept |
Gets the normal of the contact in world coordinates.
|
inlinenoexcept |
Gets the normal impulse at the given point.
AddPoint or SetNormalImpulseAtPoint method to set this value. Referenced by playrho::d2::GetNormalImpulseAtPoint().
|
inlinenoexcept |
Gets the normal mass.
|
inlinenoexcept |
Gets the normal mass at the given point.
AddPoint method sets this value. Referenced by playrho::d2::GetNormalMassAtPoint().
Accesses the point identified by the given index.
MaxManifoldPoints. | index | Index of the point to return. This should be a value less than returned by GetPointCount. |
|
inlinenoexcept |
Gets the count of points added to this object.
MaxManifoldPoints. Referenced by playrho::d2::GetContactImpulses().
|
inlinenoexcept |
Gets the point relative position of A.
AddPoint method sets this value. Referenced by playrho::d2::GetPointRelPosA().
|
inlinenoexcept |
Gets the point relative position of B.
AddPoint method sets this value. Referenced by playrho::d2::GetPointRelPosB().
|
inlinenoexcept |
Gets the tangent impulse at the given point.
AddPoint or SetTangentImpulseAtPoint method to set this value. Referenced by playrho::d2::GetTangentImpulseAtPoint().
|
inlinenoexcept |
Gets the tangent mass at the given point.
AddPoint method sets this value. Referenced by playrho::d2::GetTangentMassAtPoint().
|
inlinenoexcept |
Gets the velocity bias at the given point.
AddPoint method sets this value. Referenced by playrho::d2::GetVelocityBiasAtPoint().
Accesses the point identified by the given index.
MaxManifoldPoints. | index | Index of the point to return. This should be a value less than returned by GetPointCount. |
Referenced by SetNormalImpulseAtPoint(), and SetTangentImpulseAtPoint().
Block solver "K" info.
Referenced by GetK().
Normal mass information.
This is the cached inverse of the K value or the zero initialized value.
Referenced by GetNormalMass().