PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::Simplex Class Reference

An encapsulation of a point, line segment, or triangle. More...

#include <playrho/d2/Simplex.hpp>

Classes

struct  Cache
 Simplex cache. More...
 

Public Types

using Coefficients = ArrayList< Real, MaxSimplexEdges, std::remove_const_t< decltype(MaxSimplexEdges)> >
 Coefficients. More...
 
using size_type = SimplexEdges::size_type
 Size type.
 

Public Member Functions

constexpr Real GetCoefficient (size_type index) const noexcept
 Gets the coefficient for the given index.
 
constexpr SimplexEdges GetEdges () const noexcept
 Gets the edges.
 
const SimplexEdgeGetSimplexEdge (size_type index) const noexcept
 Gets the give indexed simplex edge.
 
constexpr size_type size () const noexcept
 Gets the size in number of simplex edges that this instance is made up of. More...
 

Static Public Member Functions

static Real CalcMetric (const SimplexEdges &simplexEdges)
 Gets the given simplex's "metric".
 
static Simplex Get (const SimplexEdge &s0) noexcept
 Gets the Simplex for the given simplex edge.
 
static Simplex Get (const SimplexEdge &s0, const SimplexEdge &s1) noexcept
 Gets the simplex for the given 2 edges. More...
 
static Simplex Get (const SimplexEdge &s0, const SimplexEdge &s1, const SimplexEdge &s2) noexcept
 Gets the simplex for the given 3 edges. More...
 
static Simplex Get (const SimplexEdges &edges) noexcept
 Gets the simplex for the given collection of vertices. More...
 
static Cache GetCache (const SimplexEdges &edges) noexcept
 Gets the cache value for the given edges.
 

Detailed Description

An encapsulation of a point, line segment, or triangle.

An encapsulation of a point, line segment, or triangle. These are defined respectively as: a 0-simplex, a 1-simplex, and a 2-simplex. Used in doing G.J.K. (GJK) collision detection.

Invariant
Vertex's for the same index must have the same point locations.
There may not be more than one entry for the same index pair.
See also
https://en.wikipedia.org/wiki/Simplex
https://en.wikipedia.org/wiki/Gilbert%2DJohnson%2DKeerthi_distance_algorithm

Member Typedef Documentation

◆ Coefficients

Coefficients.

Collection of coefficient values.

Member Function Documentation

◆ Get() [1/3]

Simplex playrho::d2::Simplex::Get ( const SimplexEdge s0,
const SimplexEdge s1 
)
staticnoexcept

Gets the simplex for the given 2 edges.

Note
The given simplex vertices must have different index pairs or be of the same values.
Warning
Behavior is not specified if the given simplex edges index pairs are the same and the whole edges values are not also the same.
Parameters
s0Simplex edge 0.
s1Simplex edge 1.
Returns
One or two edge simplex.

◆ Get() [2/3]

Simplex playrho::d2::Simplex::Get ( const SimplexEdge s0,
const SimplexEdge s1,
const SimplexEdge s2 
)
staticnoexcept

Gets the simplex for the given 3 edges.

Returns
One, two, or three edge simplex.

◆ Get() [3/3]

Simplex playrho::d2::Simplex::Get ( const SimplexEdges edges)
staticnoexcept

Gets the simplex for the given collection of vertices.

Parameters
edgesCollection of zero, one, two, or three simplex edges.
Returns
Zero, one, two, or three edge simplex.

◆ size()

constexpr Simplex::size_type playrho::d2::Simplex::size ( ) const
constexprnoexcept

Gets the size in number of simplex edges that this instance is made up of.

Gets the size in number of valid edges of this Simplex.

Returns
Value between 0 and MaxEdges (inclusive).

Referenced by Get(), and playrho::d2::GetClosestPoint().


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