Box2D
3.0.0
A Real-Time-Oriented 2-D Physics Engine
|
Manifold for two convex shapes. More...
#include <Manifold.hpp>
Classes | |
struct | Conf |
struct | Point |
Point data for a manifold. More... | |
Public Types | |
enum | Type : std::uint8_t { e_unset, e_circles, e_faceA, e_faceB } |
Manifold type. More... | |
using | size_type = std::remove_const< decltype(MaxManifoldPoints)>::type |
using | sidx_t = std::remove_const< decltype(MaxShapeVertices)>::type |
Shape index type. More... | |
using | cf_t = ContactFeature::Type |
Public Member Functions | |
Manifold ()=default | |
Default constructor. More... | |
Manifold (const Manifold ©)=default | |
constexpr Type | GetType () const noexcept |
Gets the type of this manifold. More... | |
constexpr size_type | GetPointCount () const noexcept |
Gets the manifold point count. More... | |
constexpr ContactFeature | GetContactFeature (size_type index) const noexcept |
constexpr ContactImpulses | GetContactImpulses (size_type index) const noexcept |
void | SetContactImpulses (size_type index, ContactImpulses value) noexcept |
const Point & | GetPoint (size_type index) const noexcept |
void | SetPointImpulses (size_type index, Momentum n, Momentum t) |
void | AddPoint (const Point &mp) noexcept |
Adds a new point. More... | |
void | AddPoint (cf_t type, sidx_t index, Length2D point) noexcept |
constexpr UnitVec2 | GetLocalNormal () const noexcept |
Gets the local normal for a face-type manifold. More... | |
constexpr Length2D | GetLocalPoint () const noexcept |
Gets the local point. More... | |
constexpr Length2D | GetOpposingPoint (size_type index) const noexcept |
Static Public Member Functions | |
static Manifold | GetForCircles (Length2D vA, sidx_t iA, Length2D vB, sidx_t iB) noexcept |
Gets a circles-typed manifold with one point. More... | |
static Manifold | GetForFaceA (UnitVec2 normalA, Length2D faceA) noexcept |
Gets a face A typed manifold. More... | |
static Manifold | GetForFaceA (UnitVec2 ln, Length2D lp, const Point &mp1) noexcept |
Gets a face A typed manifold. More... | |
static Manifold | GetForFaceA (UnitVec2 ln, Length2D lp, const Point &mp1, const Point &mp2) noexcept |
Gets a face A typed manifold. More... | |
static Manifold | GetForFaceB (UnitVec2 ln, Length2D lp) noexcept |
Gets a face B typed manifold. More... | |
static Manifold | GetForFaceB (UnitVec2 ln, Length2D lp, const Point &mp1) noexcept |
Gets a face B typed manifold. More... | |
static Manifold | GetForFaceB (UnitVec2 ln, Length2D lp, const Point &mp1, const Point &mp2) noexcept |
Gets a face B typed manifold. More... | |
static Manifold | GetForFaceA (UnitVec2 na, sidx_t ia, Length2D pa) noexcept |
static Manifold | GetForFaceB (UnitVec2 nb, sidx_t ib, Length2D pb) noexcept |
static Manifold | GetForFaceA (UnitVec2 na, sidx_t ia, Length2D pa, cf_t tb0, sidx_t ib0, Length2D pb0) noexcept |
static Manifold | GetForFaceB (UnitVec2 nb, sidx_t ib, Length2D pb, cf_t ta0, sidx_t ia0, Length2D pa0) noexcept |
static Manifold | GetForFaceA (UnitVec2 na, sidx_t ia, Length2D pa, cf_t tb0, sidx_t ib0, Length2D pb0, cf_t tb1, sidx_t ib1, Length2D pb1) noexcept |
static Manifold | GetForFaceB (UnitVec2 nb, sidx_t ib, Length2D pb, cf_t ta0, sidx_t ia0, Length2D pa0, cf_t ta1, sidx_t ia1, Length2D pa1) noexcept |
Manifold for two convex shapes.
This describes zero, one, or two points of contact for which impulses should be applied to most naturally resolve those contacts. Ideally the manifold is calculated at the earliest point in time of contact occuring. The further past that time, the less natural contact resolution of solid bodies will be - eventually resulting in oddities like tunneling.
Multiple types of contact are supported: clip point versus plane with radius, point versus point with radius (circles). Contacts are stored in this way so that position correction can account for movement, which is critical for continuous physics. All contact scenarios must be expressed in one of these types.
using box2d::Manifold::sidx_t = std::remove_const<decltype(MaxShapeVertices)>::type |
Shape index type.
using box2d::Manifold::size_type = std::remove_const<decltype(MaxManifoldPoints)>::type |
enum box2d::Manifold::Type : std::uint8_t |
Manifold type.
Enumerator | |
---|---|
e_unset | Unset type. Manifold is unset. For manifolds of this type: the point count is zero, point data is undefined, and all other properties are invalid. |
e_circles | Circles type. Manifold is for circle-to-circle like collisions.
|
e_faceA | Face-A type. Indicates: local point is center of face A, local normal is normal on shape A, and the local points of Point instances are the local center of cirlce B or a clip point of polygon B where the contact feature will be |
e_faceB | Face-B type. Indicates: local point is center of face B, local normal is normal on shape B, and the local points of Point instances are the local center of cirlce A or a clip point of polygon A where the contact feature will be |
|
default |
Default constructor.
Constructs an unset-type manifold. For an unset-type manifold: point count is zero, point data is undefined, and all other properties are invalid.
|
default |
|
inlinenoexcept |
Adds a new point.
This can be called once for circle type manifolds, and up to twice for face-A or face-B type manifolds. GetPointCount() can be called to find out how many points have already been added.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestaticnoexcept |
Gets a circles-typed manifold with one point.
vA | Local center of "circle" A. |
iA | Index of vertex from shape A representing the local center of "circle" A. |
vB | Local center of "circle" B. |
iB | Index of vertex from shape B representing the local center of "circle" B. |
|
inlinestaticnoexcept |
Gets a face A typed manifold.
normalA | Local normal of the face from polygon A. |
faceA | Any point in local coordinates on the face whose normal was provided. |
|
inlinestaticnoexcept |
Gets a face A typed manifold.
ln | Normal on polygon A. |
lp | Center of face A. |
mp1 | Manifold point 1 (of 1). |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
Gets a face B typed manifold.
ln | Normal on polygon B. |
lp | Center of face B. |
|
inlinestaticnoexcept |
Gets a face B typed manifold.
ln | Normal on polygon B. |
lp | Center of face B. |
mp1 | Manifold point 1. |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinenoexcept |
Gets the local normal for a face-type manifold.
|
inlinenoexcept |
Gets the local point.
This is the: local center of "circle" A for circles-type manifolds, the center of face A for face-A-type manifolds, and the center of face B for face-B-type manifolds.
|
inlinenoexcept |
Gets the manifold point count.
This is the count of contact points for this manifold. Only up to this many points can be validly accessed using the GetPoint() method.
|
inlinenoexcept |
Gets the type of this manifold.
|
inlinenoexcept |