playrho::d2::VelocityConstraint Class Reference

#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 &copy)=default
 Copy constructor. More...
 
VelocityConstraintoperator= (const VelocityConstraint &copy)=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...
 
BodyConstraintGetBodyA () const noexcept
 Gets body A. More...
 
BodyConstraintGetBodyB () 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 PointGetPointAt (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]

playrho::d2::VelocityConstraint::VelocityConstraint ( )
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]

playrho::d2::VelocityConstraint::VelocityConstraint ( const VelocityConstraint copy)
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()

static PLAYRHO_CONSTEXPR Conf playrho::d2::VelocityConstraint::GetDefaultConf ( )
inlinestaticnoexcept

Gets the default configuration for a VelocityConstraint.

Definition at line 61 of file VelocityConstraint.hpp.

◆ operator=()

VelocityConstraint& playrho::d2::VelocityConstraint::operator= ( const VelocityConstraint copy)
default

Assignment operator.

◆ GetNormal()

UnitVec playrho::d2::VelocityConstraint::GetNormal ( ) const
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()

UnitVec playrho::d2::VelocityConstraint::GetTangent ( ) const
inlinenoexcept

Gets the tangent.

Definition at line 92 of file VelocityConstraint.hpp.

◆ GetPointCount()

size_type playrho::d2::VelocityConstraint::GetPointCount ( ) const
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()

InvMass22 playrho::d2::VelocityConstraint::GetK ( ) const
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()

Mass22 playrho::d2::VelocityConstraint::GetNormalMass ( ) const
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()

Real playrho::d2::VelocityConstraint::GetFriction ( ) const
inlinenoexcept

Gets the combined friction of the associated contact.

Definition at line 111 of file VelocityConstraint.hpp.

◆ GetRestitution()

Real playrho::d2::VelocityConstraint::GetRestitution ( ) const
inlinenoexcept

Gets the combined restitution of the associated contact.

Definition at line 114 of file VelocityConstraint.hpp.

◆ GetTangentSpeed()

LinearVelocity playrho::d2::VelocityConstraint::GetTangentSpeed ( ) const
inlinenoexcept

Gets the tangent speed of the associated contact.

Definition at line 117 of file VelocityConstraint.hpp.

◆ GetBodyA()

BodyConstraint* playrho::d2::VelocityConstraint::GetBodyA ( ) const
inlinenoexcept

Gets body A.

Definition at line 120 of file VelocityConstraint.hpp.

◆ GetBodyB()

BodyConstraint* playrho::d2::VelocityConstraint::GetBodyB ( ) const
inlinenoexcept

Gets body B.

Definition at line 123 of file VelocityConstraint.hpp.

◆ GetNormalImpulseAtPoint()

Momentum playrho::d2::VelocityConstraint::GetNormalImpulseAtPoint ( VelocityConstraint::size_type  index) const
inlinenoexcept

Gets the normal impulse at the given point.

Note
Call the AddPoint or SetNormalImpulseAtPoint 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()

Momentum playrho::d2::VelocityConstraint::GetTangentImpulseAtPoint ( VelocityConstraint::size_type  index) const
inlinenoexcept

Gets the tangent impulse at the given point.

Note
Call the AddPoint or SetTangentImpulseAtPoint 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()

LinearVelocity playrho::d2::VelocityConstraint::GetVelocityBiasAtPoint ( size_type  index) const
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()

Mass playrho::d2::VelocityConstraint::GetNormalMassAtPoint ( VelocityConstraint::size_type  index) const
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()

Mass playrho::d2::VelocityConstraint::GetTangentMassAtPoint ( VelocityConstraint::size_type  index) const
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()

Length2 playrho::d2::VelocityConstraint::GetPointRelPosA ( VelocityConstraint::size_type  index) const
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()

Length2 playrho::d2::VelocityConstraint::GetPointRelPosB ( VelocityConstraint::size_type  index) const
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()

void playrho::d2::VelocityConstraint::SetNormalImpulseAtPoint ( VelocityConstraint::size_type  index,
Momentum  value 
)
inline

Sets the normal impulse at the given point.

Definition at line 352 of file VelocityConstraint.hpp.

◆ SetTangentImpulseAtPoint()

void playrho::d2::VelocityConstraint::SetTangentImpulseAtPoint ( VelocityConstraint::size_type  index,
Momentum  value 
)
inline

Sets the tangent impulse at the given point.

Definition at line 357 of file VelocityConstraint.hpp.

◆ GetPointAt()

const Point& playrho::d2::VelocityConstraint::GetPointAt ( size_type  index) const
inline

Accesses the point identified by the given index.

Warning
Behavior is undefined if given index is not less than MaxManifoldPoints.
Parameters
indexIndex 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: