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

#include <Simplex.hpp>

Classes

struct  Cache
 Simplex cache. More...
 

Public Types

using size_type = SimplexEdges::size_type
 
using Coefficients = ArrayList< Real, MaxSimplexEdges, std::remove_const< decltype(MaxSimplexEdges)>::type >
 

Public Member Functions

 Simplex ()=default
 
PLAYRHO_CONSTEXPR SimplexEdges GetEdges () const noexcept
 Gets the edges. More...
 
const SimplexEdgeGetSimplexEdge (size_type index) const noexcept
 Gets the give indexed simplex edge. More...
 
PLAYRHO_CONSTEXPR Real GetCoefficient (size_type index) const noexcept
 Gets the coefficient for the given index. More...
 
PLAYRHO_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 Cache GetCache (const SimplexEdges &edges) noexcept
 Gets the cache value for the given edges. More...
 
static Real CalcMetric (const SimplexEdges &simplexEdges)
 Gets the given simplex's "metric". More...
 
static Simplex Get (const SimplexEdge &s0) noexcept
 Gets the Simplex for the given simplex edge. More...
 
static Simplex Get (const SimplexEdge &s0, const SimplexEdge &s1) noexcept
 
static Simplex Get (const SimplexEdge &s0, const SimplexEdge &s1, const SimplexEdge &s2) noexcept
 
static Simplex Get (const SimplexEdges &edges) noexcept
 

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. collision detection.

Note
This data structure is 104-bytes large.
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

Definition at line 59 of file Simplex.hpp.

Member Typedef Documentation

◆ size_type

using playrho::d2::Simplex::size_type = SimplexEdges::size_type

Size type.

Note
This data type is explicitly set to 1-byte large.

Definition at line 66 of file Simplex.hpp.

◆ Coefficients

using playrho::d2::Simplex::Coefficients = ArrayList<Real, MaxSimplexEdges, std::remove_const<decltype(MaxSimplexEdges)>::type>

Coefficients.

Collection of coefficient values.

Note
This data structure is 4 * 3 + 4 = 16-bytes large.

Definition at line 75 of file Simplex.hpp.

Constructor & Destructor Documentation

◆ Simplex()

playrho::d2::Simplex::Simplex ( )
default

Member Function Documentation

◆ GetCache()

Simplex::Cache playrho::d2::Simplex::GetCache ( const SimplexEdges edges)
inlinestaticnoexcept

Gets the cache value for the given edges.

Definition at line 161 of file Simplex.hpp.

◆ CalcMetric()

Real playrho::d2::Simplex::CalcMetric ( const SimplexEdges simplexEdges)
static

Gets the given simplex's "metric".

Definition at line 223 of file Simplex.cpp.

◆ Get() [1/4]

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

Gets the Simplex for the given simplex edge.

Definition at line 60 of file Simplex.cpp.

◆ Get() [2/4]

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 undefined 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.

Definition at line 65 of file Simplex.cpp.

◆ Get() [3/4]

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.

Definition at line 118 of file Simplex.cpp.

◆ Get() [4/4]

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.
Warning
Behavior is undefined if the given collection has more than 3 edges.
Returns
Zero, one, two, or three edge simplex.

Definition at line 209 of file Simplex.cpp.

◆ GetEdges()

PLAYRHO_CONSTEXPR SimplexEdges playrho::d2::Simplex::GetEdges ( ) const
inlinenoexcept

Gets the edges.

Definition at line 178 of file Simplex.hpp.

◆ GetSimplexEdge()

const SimplexEdge & playrho::d2::Simplex::GetSimplexEdge ( size_type  index) const
inlinenoexcept

Gets the give indexed simplex edge.

Definition at line 183 of file Simplex.hpp.

◆ GetCoefficient()

PLAYRHO_CONSTEXPR Real playrho::d2::Simplex::GetCoefficient ( size_type  index) const
inlinenoexcept

Gets the coefficient for the given index.

Definition at line 188 of file Simplex.hpp.

◆ size()

PLAYRHO_CONSTEXPR Simplex::size_type playrho::d2::Simplex::size ( ) const
inlinenoexcept

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).

Definition at line 195 of file Simplex.hpp.


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