Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Member Functions | List of all members
box2d::Simplex::Cache Class Reference

Simplex cache. More...

#include <Simplex.hpp>

Public Member Functions

 Cache ()=default
 
 Cache (const Cache &copy)=default
 
BOX2D_CONSTEXPR Cache (RealNum metric, IndexPairs indices) noexcept
 
RealNum GetMetric () const noexcept
 Gets the metric that was set. More...
 
bool IsMetricSet () const noexcept
 
BOX2D_CONSTEXPR IndexPairs GetIndices () const noexcept
 
BOX2D_CONSTEXPR size_type GetNumIndices () const noexcept
 
BOX2D_CONSTEXPR IndexPair GetIndexPair (size_type index) const noexcept
 

Detailed Description

Simplex cache.

Used to warm start Distance. Caches particular information from a simplex - a related metric and up-to 3 index pairs.

Invariant
As the metric and list of index pairs should be values from a snapshot of a simplex, the mertic and list of index pairs must not vary independent of each other. As such, this data structure only allows these values to be changed in unision via object construction or object assignment.
Note
This data structure is 12-bytes large.

Constructor & Destructor Documentation

◆ Cache() [1/3]

box2d::Simplex::Cache::Cache ( )
default

◆ Cache() [2/3]

box2d::Simplex::Cache::Cache ( const Cache copy)
default

◆ Cache() [3/3]

BOX2D_CONSTEXPR box2d::Simplex::Cache::Cache ( RealNum  metric,
IndexPairs  indices 
)
inlinenoexcept

Member Function Documentation

◆ GetIndexPair()

BOX2D_CONSTEXPR IndexPair box2d::Simplex::Cache::GetIndexPair ( size_type  index) const
inlinenoexcept

◆ GetIndices()

BOX2D_CONSTEXPR Simplex::IndexPairs box2d::Simplex::Cache::GetIndices ( ) const
inlinenoexcept

◆ GetMetric()

RealNum box2d::Simplex::Cache::GetMetric ( ) const
inlinenoexcept

Gets the metric that was set.

Note
Behavior is undefined if metric was not previously set. The IsMetricSet() method can be used to check dynamically if unsure.
See also
SetMetric.
IsMetricSet.
Returns
Value previously set.

◆ GetNumIndices()

BOX2D_CONSTEXPR Simplex::size_type box2d::Simplex::Cache::GetNumIndices ( ) const
inlinenoexcept

◆ IsMetricSet()

bool box2d::Simplex::Cache::IsMetricSet ( ) const
inlinenoexcept

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