PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::WorldManifold Class Reference

Essentially a Manifold expressed in world coordinate terms. More...

#include <WorldManifold.hpp>

Collaboration diagram for playrho::d2::WorldManifold:
[legend]

Classes

struct  PointData
 Point data for world manifold. More...
 

Public Types

using size_type = std::remove_const< decltype(MaxManifoldPoints)>::type
 Size type.
 

Public Member Functions

 WorldManifold ()=default
 Default constructor. More...
 
constexpr WorldManifold (UnitVec normal) noexcept
 Initializing constructor.
 
constexpr WorldManifold (UnitVec normal, PointData ps0) noexcept
 Initializing constructor.
 
constexpr WorldManifold (UnitVec normal, PointData ps0, PointData ps1) noexcept
 Initializing constructor.
 
size_type GetPointCount () const noexcept
 Gets the point count. More...
 
UnitVec GetNormal () const noexcept
 Gets the normal of the contact. More...
 
Length2 GetPoint (size_type index) const noexcept
 Gets the indexed point's location in world coordinates. More...
 
Length GetSeparation (size_type index) const noexcept
 Gets the amount of separation at the given indexed point. More...
 
Momentum2 GetImpulses (size_type index) const noexcept
 Gets the given index contact impulses. More...
 

Private Attributes

UnitVec m_normal = GetInvalid<UnitVec>()
 world vector pointing from A to B
 
Length2 m_points [MaxManifoldPoints] = {GetInvalid<Length2>(), GetInvalid<Length2>()}
 Points. More...
 
Momentum2 m_impulses [MaxManifoldPoints] = {Momentum2{}, Momentum2{}}
 Impulses. More...
 
Length m_separations [MaxManifoldPoints] = {GetInvalid<Length>(), GetInvalid<Length>()}
 Separations. More...
 

Detailed Description

Essentially a Manifold expressed in world coordinate terms.

Used to recognize the current state of a contact manifold in world coordinates.

Note
This data structure is 48-bytes large (on at least one 64-bit platform).
See also
GetWorldManifold
Examples
WorldContact.cpp.

Constructor & Destructor Documentation

◆ WorldManifold()

playrho::d2::WorldManifold::WorldManifold ( )
default

Default constructor.

A default constructed world manifold will gave a point count of zero, an invalid normal, invalid points, and invalid separations.

Member Function Documentation

◆ GetImpulses()

Momentum2 playrho::d2::WorldManifold::GetImpulses ( size_type  index) const
inlinenoexcept

Gets the given index contact impulses.

Returns
"Normal impulse" and "tangent impulse" pair.

◆ GetNormal()

UnitVec playrho::d2::WorldManifold::GetNormal ( ) const
inlinenoexcept

Gets the normal of the contact.

This is a directional unit-vector.

Returns
Normal of the contact or an invalid value.

◆ GetPoint()

Length2 playrho::d2::WorldManifold::GetPoint ( size_type  index) const
inlinenoexcept

Gets the indexed point's location in world coordinates.

Warning
Behavior is undefined if the index value is not less than MaxManifoldPoints
Parameters
indexIndex to return point for. This must be between 0 and GetPointCount() to get a valid point from this method.
Returns
Point or an invalid value if the given index was invalid.

◆ GetPointCount()

size_type playrho::d2::WorldManifold::GetPointCount ( ) const
inlinenoexcept

Gets the point count.

This is the maximum index value that can be used to access valid point or separation information.

Returns
Value between 0 and 2.

◆ GetSeparation()

Length playrho::d2::WorldManifold::GetSeparation ( size_type  index) const
inlinenoexcept

Gets the amount of separation at the given indexed point.

Warning
Behavior is undefined if the index value is not less than MaxManifoldPoints
Parameters
indexIndex to return separation for. This must be between 0 and GetPointCount().
Returns
Separation amount (a negative value), or an invalid value if the given index was invalid.

Member Data Documentation

◆ m_impulses

Momentum2 playrho::d2::WorldManifold::m_impulses[MaxManifoldPoints] = {Momentum2{}, Momentum2{}}
private

Impulses.

Note
16-bytes.

Referenced by GetImpulses().

◆ m_points

Length2 playrho::d2::WorldManifold::m_points[MaxManifoldPoints] = {GetInvalid<Length2>(), GetInvalid<Length2>()}
private

Points.

Manifold's contact points in world coordinates (mid-point of intersection)

Note
16-bytes.

Referenced by GetPoint().

◆ m_separations

Length playrho::d2::WorldManifold::m_separations[MaxManifoldPoints] = {GetInvalid<Length>(), GetInvalid<Length>()}
private

Separations.

A negative value indicates overlap.

Referenced by GetPointCount(), and GetSeparation().


The documentation for this class was generated from the following file: