PlayRho  2.0.0
An interactive physics engine & library.
playrho::ToiConf Struct Reference

Time of impact configuration. More...

#include <playrho/ToiConf.hpp>

Collaboration diagram for playrho::ToiConf:
[legend]

Public Types

using dist_iter_type = std::remove_const_t< decltype(DefaultMaxDistanceIters)>
 Distance iteration type.
 
using root_iter_type = std::remove_const_t< decltype(DefaultMaxToiRootIters)>
 Root iteration type.
 
using toi_iter_type = std::remove_const_t< decltype(DefaultMaxToiIters)>
 TOI iteration type.
 

Public Member Functions

constexpr ToiConfUseMaxDistIters (dist_iter_type value) noexcept
 Uses the given max distance iterations value.
 
constexpr ToiConfUseMaxRootIters (root_iter_type value) noexcept
 Uses the given max root iterations value.
 
constexpr ToiConfUseMaxToiIters (toi_iter_type value) noexcept
 Uses the given max TOI iterations value.
 
constexpr ToiConfUseTargetDepth (NonNegative< Length > value) noexcept
 Uses the given target depth value.
 
constexpr ToiConfUseTimeMax (UnitInterval< Real > value) noexcept
 Uses the given time max value.
 
constexpr ToiConfUseTolerance (NonNegative< Length > value) noexcept
 Uses the given tolerance value.
 

Public Attributes

dist_iter_type maxDistIters = DefaultMaxDistanceIters
 Max distance iterations.
 
root_iter_type maxRootIters = DefaultMaxToiRootIters
 Maximum number of root finder iterations. More...
 
toi_iter_type maxToiIters = DefaultMaxToiIters
 Max time of impact iterations.
 
NonNegative< LengthtargetDepth = DefaultTargetDepth
 Targeted depth of impact. More...
 
UnitInterval< RealtimeMax = DefaultTimeMax
 Time max expressed as a unit interval between 0 and 1 inclusive.
 
NonNegative< Lengthtolerance = DefaultTolerance
 Tolerance. More...
 

Static Public Attributes

static constexpr auto DefaultTargetDepth = NonNegative<Length>{DefaultLinearSlop * Real(3)}
 Default target depth.
 
static constexpr auto DefaultTimeMax = UnitIntervalFF<Real>(Real(1))
 Default time max.
 
static constexpr auto DefaultTolerance = NonNegative<Length>{DefaultLinearSlop / Real(4)}
 Default tolerance.
 

Related Functions

(Note that these are not member functions.)

constexpr auto GetDefaultToiConf ()
 Gets the default time of impact configuration.
 
ToiConf GetToiConf (const StepConf &conf) noexcept
 Gets the time of impact configuration for the given step configuration.
 

Detailed Description

Time of impact configuration.

These parameters effect time of impact calculations by limiting the definitions of time and impact. If total radius is expressed as TR, and target depth as TD, then: the max target distance is (TR - TD) + tolerance; and the min target distance is (TR - TD) - tolerance.

Note
Max target distance must be less than or equal to the total radius as the target range has to be chosen such that the contact manifold will have a greater than zero contact point count.
A max target of totalRadius - DefaultLinearSlop * x where x is <= 1 is increasingly slower as x goes below 1.
Min target distance needs to be significantly less than the max target distance and significantly more than 0.
See also
SolvePositionConstraints
SolveTOIPositionConstraints

Member Data Documentation

◆ maxRootIters

root_iter_type playrho::ToiConf::maxRootIters = DefaultMaxToiRootIters

Maximum number of root finder iterations.

This is the maximum number of iterations for calculating the 1-dimensional root of f(t) - (totalRadius - targetDepth) < tolerance where f(t) is the distance between the shapes at time t, and totalRadius is the sum of the vertex radiuses of 2 distance proxies.

Note
This value never needs to be more than the number of iterations needed to achieve full machine precision.

Referenced by playrho::ToiOutput::GetToiViaSat().

◆ targetDepth

NonNegative<Length> playrho::ToiConf::targetDepth = DefaultTargetDepth

Targeted depth of impact.

Note
Value should be less than twice the minimum vertex radius of any shape.

Referenced by playrho::ToiOutput::GetToiViaSat().

◆ tolerance

NonNegative<Length> playrho::ToiConf::tolerance = DefaultTolerance

Tolerance.

Provides a +/- range from the target depth that defines a minimum and maximum target depth within which inclusively, time of impact calculating code is expected to return a "touching" status.

Note
Use the default value unless you really know what you're doing.
A value of 0 requires a TOI at exactly the target depth. This is ill-advised.

Referenced by playrho::ToiOutput::GetToiViaSat().


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