Time of impact configuration. More...

#include <TimeOfImpact.hpp>

Public Types

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

Public Member Functions

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

Public Attributes

Real tMax = 1
 T-Max. More...
 
Length targetDepth = DefaultLinearSlop * Real{3}
 Targeted depth of impact. More...
 
NonNegative< Lengthtolerance = NonNegative<Length>{DefaultLinearSlop / Real{4}}
 Tolerance. More...
 
root_iter_type maxRootIters = DefaultMaxToiRootIters
 Maximum number of root finder iterations. More...
 
toi_iter_type maxToiIters = DefaultMaxToiIters
 Max time of impact iterations. More...
 
dist_iter_type maxDistIters = DefaultMaxDistanceIters
 Max distance iterations. More...
 

Related Functions

(Note that these are not member functions.)

PLAYRHO_CONSTEXPR auto GetDefaultToiConf ()
 Gets the default time of impact configuration. More...
 

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

Definition at line 51 of file TimeOfImpact.hpp.

Member Typedef Documentation

◆ root_iter_type

using playrho::ToiConf::root_iter_type = std::remove_const<decltype(DefaultMaxToiRootIters)>::type

Root iteration type.

Definition at line 54 of file TimeOfImpact.hpp.

◆ toi_iter_type

using playrho::ToiConf::toi_iter_type = std::remove_const<decltype(DefaultMaxToiIters)>::type

TOI iteration type.

Definition at line 57 of file TimeOfImpact.hpp.

◆ dist_iter_type

using playrho::ToiConf::dist_iter_type = std::remove_const<decltype(DefaultMaxDistanceIters)>::type

Distance iteration type.

Definition at line 60 of file TimeOfImpact.hpp.

Member Function Documentation

◆ UseTimeMax()

PLAYRHO_CONSTEXPR ToiConf & playrho::ToiConf::UseTimeMax ( Real  value)
inlinenoexcept

Uses the given time max value.

Definition at line 109 of file TimeOfImpact.hpp.

◆ UseTargetDepth()

PLAYRHO_CONSTEXPR ToiConf & playrho::ToiConf::UseTargetDepth ( Length  value)
inlinenoexcept

Uses the given target depth value.

Definition at line 115 of file TimeOfImpact.hpp.

◆ UseTolerance()

PLAYRHO_CONSTEXPR ToiConf & playrho::ToiConf::UseTolerance ( NonNegative< Length value)
inlinenoexcept

Uses the given tolerance value.

Definition at line 121 of file TimeOfImpact.hpp.

◆ UseMaxRootIters()

PLAYRHO_CONSTEXPR ToiConf & playrho::ToiConf::UseMaxRootIters ( root_iter_type  value)
inlinenoexcept

Uses the given max root iterations value.

Definition at line 127 of file TimeOfImpact.hpp.

◆ UseMaxToiIters()

PLAYRHO_CONSTEXPR ToiConf & playrho::ToiConf::UseMaxToiIters ( toi_iter_type  value)
inlinenoexcept

Uses the given max TOI iterations value.

Definition at line 133 of file TimeOfImpact.hpp.

◆ UseMaxDistIters()

PLAYRHO_CONSTEXPR ToiConf & playrho::ToiConf::UseMaxDistIters ( dist_iter_type  value)
inlinenoexcept

Uses the given max distance iterations value.

Definition at line 139 of file TimeOfImpact.hpp.

Friends And Related Function Documentation

◆ GetDefaultToiConf()

PLAYRHO_CONSTEXPR auto GetDefaultToiConf ( )
related

Gets the default time of impact configuration.

Definition at line 147 of file TimeOfImpact.hpp.

Member Data Documentation

◆ tMax

Real playrho::ToiConf::tMax = 1

T-Max.

Definition at line 81 of file TimeOfImpact.hpp.

◆ targetDepth

Length playrho::ToiConf::targetDepth = DefaultLinearSlop * Real{3}

Targeted depth of impact.

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

Definition at line 85 of file TimeOfImpact.hpp.

◆ tolerance

NonNegative<Length> playrho::ToiConf::tolerance = NonNegative<Length>{DefaultLinearSlop / Real{4}}

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.
Use 0 to require a TOI at exactly the target depth. This is ill-advised.

Definition at line 93 of file TimeOfImpact.hpp.

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

Definition at line 102 of file TimeOfImpact.hpp.

◆ maxToiIters

toi_iter_type playrho::ToiConf::maxToiIters = DefaultMaxToiIters

Max time of impact iterations.

Definition at line 104 of file TimeOfImpact.hpp.

◆ maxDistIters

dist_iter_type playrho::ToiConf::maxDistIters = DefaultMaxDistanceIters

Max distance iterations.

Definition at line 106 of file TimeOfImpact.hpp.


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