PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::TOIOutput Struct Reference

Output data for time of impact. More...

#include <TimeOfImpact.hpp>

Collaboration diagram for playrho::TOIOutput:
[legend]

Classes

struct  Statistics
 Time of impact statistics. More...
 

Public Types

enum  State : std::uint8_t {
  e_unknown, e_touching, e_separated, e_overlapped,
  e_maxRootIters, e_nextAfter, e_maxToiIters, e_belowMinTarget,
  e_maxDistIters, e_targetDepthExceedsTotalRadius, e_minTargetSquaredOverflow, e_maxTargetSquaredOverflow,
  e_notFinite
}
 State. More...
 

Public Member Functions

 TOIOutput ()=default
 Default constructor.
 
 TOIOutput (Real t, Statistics s, State z) noexcept
 Initializing constructor.
 

Public Attributes

Real time = 0
 Time factor in range of [0,1] into the future.
 
Statistics stats
 Statistics.
 
State state = e_unknown
 State at time factor.
 

Related Functions

(Note that these are not member functions.)

TOIOutput GetToiViaSat (const DistanceProxy &proxyA, const Sweep &sweepA, const DistanceProxy &proxyB, const Sweep &sweepB, ToiConf conf=GetDefaultToiConf())
 Gets the time of impact for two disjoint convex sets using the Separating Axis Theorem. More...
 

Detailed Description

Output data for time of impact.

Member Enumeration Documentation

◆ State

enum playrho::TOIOutput::State : std::uint8_t

State.

Enumerator
e_unknown 

Unknown.

Unknown state.

Note
This is the default initialized state.
e_touching 

Touching.

Indicates that the returned time of impact for two convex polygons is for a time at which the two polygons are within the minimum and maximum target range inclusively.

Note
This is a desirable result.
Time of impact is the time when the two convex polygons "touch".
e_separated 

Separated.

Indicates that the two convex polygons never actually collide during their defined sweeps.

Note
This is a desirable result.
Time of impact in this case is tMax (which is typically 1).
e_overlapped 

Overlapped.

Indicates that the two convex polygons are closer to each other at the returned time than the target depth range allows for.

Note
Can happen if total radius of the two convex polygons is too small.
Can happen if the tolerance is too low.
Time of impact is the time when the two convex polygons have already collided too much.
e_maxRootIters 

Max root iterations.

Got to max number of root iterations allowed.

Note
Can happen if the configured max number of root iterations is too low.
Can happen if the tolerance is too small.
e_nextAfter 

Next after.

Note
Can happen if the length moved is too much bigger than the tolerance.
e_maxToiIters 

Max TOI iterations.

e_belowMinTarget 

Below minimum target.

e_maxDistIters 

Max distance iterations.

Indicates that the maximum number of distance iterations was done.

Note
Can happen if the configured max number of distance iterations was too low.

Friends And Related Function Documentation

◆ GetToiViaSat()

TOIOutput GetToiViaSat ( const DistanceProxy &  proxyA,
const Sweep &  sweepA,
const DistanceProxy &  proxyB,
const Sweep &  sweepB,
ToiConf  conf = GetDefaultToiConf() 
)
related

Gets the time of impact for two disjoint convex sets using the Separating Axis Theorem.

Computes the upper bound on time before two shapes penetrate too much. Time is represented as a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, non-tunneling collision. If you change the time interval, you should call this function again.

See also
https://en.wikipedia.org/wiki/Hyperplane_separation_theorem
Precondition
The given sweeps are both at the same alpha-0.
Warning
Behavior is undefined if sweeps are not at the same alpha-0.
Behavior is undefined if the configuration's tMax is not between 0 and 1 inclusive.
Note
Uses Distance to compute the contact point and normal at the time of impact.
This only works for two disjoint convex sets.
Parameters
proxyAProxy A. The proxy's vertex count must be 1 or more.
sweepASweep A. Sweep of motion for shape represented by proxy A.
proxyBProxy B. The proxy's vertex count must be 1 or more.
sweepBSweep B. Sweep of motion for shape represented by proxy B.
confConfiguration details for on calculation. Like the targeted depth of penetration.
Returns
Time of impact output data.

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