SurgSim::Collision::SegmentSegmentCcdIntervalCheck Class Reference

SegmentSegmentCcdIntervalCheck uses the Interval classes including the LinearMotion and Polynomial families to quickly determine if there is a possible collision between two moving segments over a specified time interval. More...

`#include <SurgSim/Collision/SegmentSegmentCcdIntervalCheck.h>`

## Public Types

enum | IntervalCheckResults { IntervalCheckPossibleCollision, IntervalCheckNoCollisionVolume, IntervalCheckNoCollisionEndpoints }
| Enum Possible interval check return values. More...

## Public Member Functions

| SegmentSegmentCcdIntervalCheck (const std::array< Math::Vector3d, 2 > &pT0, const std::array< Math::Vector3d, 2 > &pT1, const std::array< Math::Vector3d, 2 > &qT0, const std::array< Math::Vector3d, 2 > &qT1, double thicknessP, double thicknessQ, double timePrecisionEpsilon, double distanceEpsilon)
| Constructor. More...
const Math::PolynomialValues< double, 3 > & | P1Q1_P1P2_Q1Q2 () const
| Triple product value. More...
Math::Interval< double > | crossValueOnInterval (const Math::Interval< double > &range) const
IntervalCheckResults | possibleCollisionTestNoThickness (const Math::Interval< double > &range) const
| Check if a collision is possible within a specified time interval assuming ideal (0 thickness) segments. More...
IntervalCheckResults | possibleCollisionTestWithThickness (const Math::Interval< double > &range) const
| Check if a collision is possible within a specified time interval assuming segments with fixed radius. More...
const Math::LinearMotionND< double, 3 > & | motionP1 () const
const Math::LinearMotionND< double, 3 > & | motionP2 () const
const Math::LinearMotionND< double, 3 > & | motionQ1 () const
const Math::LinearMotionND< double, 3 > & | motionQ2 () const
Math::Vector3d | p1T0 () const
Math::Vector3d | p1T1 () const
Math::Vector3d | p2T0 () const
Math::Vector3d | p2T1 () const
Math::Vector3d | q1T0 () const
Math::Vector3d | q1T1 () const
Math::Vector3d | q2T0 () const
Math::Vector3d | q2T1 () const
const Math::PolynomialValues< double, 2 > & | P1P2_P1Q1 () const
const Math::PolynomialValues< double, 2 > & | Q1Q2_P1Q1 () const
const Math::PolynomialValues< double, 2 > & | P1P2_Q1Q2 () const
const Math::PolynomialValues< double, 2 > & | P1P2_sq () const
const Math::PolynomialValues< double, 2 > & | Q1Q2_sq () const
double | thicknessP () const
double | thicknessQ () const
void | setTimePrecisionEpsilon (double epsilon)
void | setDistanceEpsilon (double epsilon)
void | setTripleProductEpsilon (double epsilon)
void | setMuNuEpsilon (double epsilon)
double | timePrecisionEpsilon () const
double | distanceEpsilon () const
double | tripleProductEpsilon () const
double | muNuEpsilon () const

## Private Member Functions

| SegmentSegmentCcdIntervalCheck (const SegmentSegmentCcdIntervalCheck &)
SegmentSegmentCcdIntervalCheck & | operator= (const SegmentSegmentCcdIntervalCheck &)

## Private Attributes

Math::PolynomialValues< double, 3 > | m_P1Q1_P1P2_Q1Q2
| The triple product of (Q1(t) - P1(t)) X (P2(t) - P1(t)) X (Q2(t) - Q1(t)) as a 3rd degree polynomial where P1, P2,Q1 and Q2 are time dependent positions for the segment endpoints. More...
Math::LinearMotionND< double, 3 > | m_motionP1
Math::LinearMotionND< double, 3 > | m_motionP2
Math::LinearMotionND< double, 3 > | m_motionQ1
Math::LinearMotionND< double, 3 > | m_motionQ2
Math::LinearMotionND< double, 3 > | m_relativeP1Q1
Math::LinearMotionND< double, 3 > | m_relativeQ1Q2
Math::LinearMotionND< double, 3 > | m_relativeP1P2
Math::PolynomialValues< double, 2 > | m_P1P2_P1Q1
Math::PolynomialValues< double, 2 > | m_Q1Q2_P1Q1
Math::PolynomialValues< double, 2 > | m_P1P2_Q1Q2
Math::PolynomialValues< double, 2 > | m_P1P2_sq
Math::PolynomialValues< double, 2 > | m_Q1Q2_sq
Math::PolynomialValues< double, 2 > | m_P1P2xQ1Q2_x
Math::PolynomialValues< double, 2 > | m_P1P2xQ1Q2_y
Math::PolynomialValues< double, 2 > | m_P1P2xQ1Q2_z
double | m_thicknessP
double | m_thicknessQ
double | m_timePrecisionEpsilon
double | m_distanceEpsilon
double | m_volumeEpsilonTimes6
double | m_muNuEpsilon

## Detailed Description

SegmentSegmentCcdIntervalCheck uses the Interval classes including the LinearMotion and Polynomial families to quickly determine if there is a possible collision between two moving segments over a specified time interval.

The time interval under consideration is defined as a subset of the parametric time interval [0, 1].

Details of the actual time of collision and the implementation of the recursion strategy are at a higher level.

See also
  Interval<T>, IntervalND<T, N>, LinearMotion<T, N>, and Polynomial<T, N>

## Member Enumeration Documentation

## IntervalCheckResults

enum SurgSim::Collision::SegmentSegmentCcdIntervalCheck::IntervalCheckResults

Enum Possible interval check return values.

IntervalCheckPossibleCollision indicates the given interval may have a collision between the segments, while IntervalCheckNoCollisionVolume indicates no collision based on a gross volume calculation and IntervalCheckNoCollisionEndpoints indicates that the endpoint check indicates that the segments do not overlap at closest approach.

Enumerator
IntervalCheckPossibleCollision |
IntervalCheckNoCollisionVolume |
IntervalCheckNoCollisionEndpoints |

## Constructor & Destructor Documentation

## SegmentSegmentCcdIntervalCheck() [1/2]

SurgSim::Collision::SegmentSegmentCcdIntervalCheck::SegmentSegmentCcdIntervalCheck | ( | const std::array< Math::Vector3d, 2 > & | pT0,
|  | const std::array< Math::Vector3d, 2 > & | pT1,
|  | const std::array< Math::Vector3d, 2 > & | qT0,
|  | const std::array< Math::Vector3d, 2 > & | qT1,
|  | double | thicknessP,
|  | double | thicknessQ,
|  | double | timePrecisionEpsilon,
|  | double | distanceEpsilon
| ) |  |

Constructor.

Parameters

  pT0 | Starting and ending vertices for segment p at time 0
  pT1 | Starting and ending vertices for segment p at time 1
  qT0 | Starting and ending vertices for segment q at time 0
  qT1 | Starting and ending vertices for segment q at time 1
  thicknessP | Radius of segment P
  thicknessQ | Radius of segment Q
  timePrecisionEpsilon | Desired time accuracy
  distanceEpsilon | Desired distance accuracy

## SegmentSegmentCcdIntervalCheck() [2/2]

SurgSim::Collision::SegmentSegmentCcdIntervalCheck::SegmentSegmentCcdIntervalCheck | ( | const SegmentSegmentCcdIntervalCheck & |  | ) |

private

Private constructor and assignment operators to prevent copying.

## Member Function Documentation

## crossValueOnInterval()

Math::Interval< double > SurgSim::Collision::SegmentSegmentCcdIntervalCheck::crossValueOnInterval | ( | const Math::Interval< double > & | range | ) | const

Parameters

  range | the interval over which the cross product values are to be bounded.

Returns
  the minimum and maximum of (P2 - P1) X (Q2 - Q1) restricted to the interval range.

## distanceEpsilon()

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::distanceEpsilon | ( |  | ) | const

Algorithm epsilons

Returns
  the algorithm epsilon parameters for "close enough" decisions.

## motionP1()

const Math::LinearMotionND< double, 3 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionP1 | ( |  | ) | const

Motion accessors

Returns
  the motion vector (value(t1) - value(t0)) for the segment endpoints p1, p2, q1, and q2, respectively.

## motionP2()

const Math::LinearMotionND< double, 3 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionP2 | ( |  | ) | const

Motion accessors

Returns
  the motion vector (value(t1) - value(t0)) for the segment endpoints p1, p2, q1, and q2, respectively.

## motionQ1()

const Math::LinearMotionND< double, 3 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionQ1 | ( |  | ) | const

Motion accessors

Returns
  the motion vector (value(t1) - value(t0)) for the segment endpoints p1, p2, q1, and q2, respectively.

## motionQ2()

const Math::LinearMotionND< double, 3 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionQ2 | ( |  | ) | const

Motion accessors

Returns
  the motion vector (value(t1) - value(t0)) for the segment endpoints p1, p2, q1, and q2, respectively.

## muNuEpsilon()

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::muNuEpsilon | ( |  | ) | const

Algorithm epsilons

Returns
  the algorithm epsilon parameters for "close enough" decisions.

## operator=()

SegmentSegmentCcdIntervalCheck& SurgSim::Collision::SegmentSegmentCcdIntervalCheck::operator= | ( | const SegmentSegmentCcdIntervalCheck & |  | ) |

private

Private constructor and assignment operators to prevent copying.

## P1P2_P1Q1()

const Math::PolynomialValues< double, 2 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1P2_P1Q1 | ( |  | ) | const

Dot product accessors for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t)

Returns
  the dot product of the difference operators for the named endpoints

## P1P2_Q1Q2()

const Math::PolynomialValues< double, 2 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1P2_Q1Q2 | ( |  | ) | const

Dot product accessors for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t)

Returns
  the dot product of the difference operators for the named endpoints

## P1P2_sq()

const Math::PolynomialValues< double, 2 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1P2_sq | ( |  | ) | const

Magnitude squared product accessors

Returns
  the squared magnitude of the difference operators for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t).

## P1Q1_P1P2_Q1Q2()

const Math::PolynomialValues< double, 3 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1Q1_P1P2_Q1Q2 | ( |  | ) | const

Triple product value.

Returns
  the triple product of (Q1(t) - P1(t)) X (P2(t) - P1(t)) X (Q2(t) - Q1(t)) as a 3rd degree polynomial where P1, P2,Q1 and Q2 are time dependent positions for the segment endpoints.

Note
  the triple product is equivalent to 6 x the volume of tetrahedron P1P2Q1Q2. The polynomial captures the variation in volume over the time interval.

## p1T0()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p1T0 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## p1T1()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p1T1 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## p2T0()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p2T0 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## p2T1()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p2T1 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## possibleCollisionTestNoThickness()

SegmentSegmentCcdIntervalCheck::IntervalCheckResults SurgSim::Collision::SegmentSegmentCcdIntervalCheck::possibleCollisionTestNoThickness | ( | const Math::Interval< double > & | range | ) | const

Check if a collision is possible within a specified time interval assuming ideal (0 thickness) segments.

Parameters

  range | the parametric [0, 1] time interval over which the collision is to be detected.

Returns
  IntervalCheckPossibleCollision, IntervalCheckNoCollisionVolume, or IntervalCheckNoCollisionEndpoints indicating if a collision is possible (returns IntervalCheckPossibleCollision); if tetrahedron (P1, P2, Q1, Q2) has too great a volume for a collision (returns IntervalCheckNoCollisionVolume); or if the possibly valid collision is not contained within segments (P1, P2) and (Q1, Q2) (returns IntervalCheckNoCollisionEndpoints).

## possibleCollisionTestWithThickness()

SegmentSegmentCcdIntervalCheck::IntervalCheckResults SurgSim::Collision::SegmentSegmentCcdIntervalCheck::possibleCollisionTestWithThickness | ( | const Math::Interval< double > & | range | ) | const

Check if a collision is possible within a specified time interval assuming segments with fixed radius.

Parameters

  range | the parametric [0, 1] time interval over which the collision is to be detected.

Returns
  IntervalCheckPossibleCollision, IntervalCheckNoCollisionVolume, or IntervalCheckNoCollisionEndpoints indicating if a collision is possible (returns IntervalCheckPossibleCollision); if tetrahedron (P1, P2, Q1, Q2) has too great a volume for a collision (returns IntervalCheckNoCollisionVolume); or if the possibly valid collision is not contained within segments (P1, P2) and (Q1, Q2) (returns IntervalCheckNoCollisionEndpoints).

## Q1Q2_P1Q1()

const Math::PolynomialValues< double, 2 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::Q1Q2_P1Q1 | ( |  | ) | const

Dot product accessors for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t)

Returns
  the dot product of the difference operators for the named endpoints

## Q1Q2_sq()

const Math::PolynomialValues< double, 2 > & SurgSim::Collision::SegmentSegmentCcdIntervalCheck::Q1Q2_sq | ( |  | ) | const

Magnitude squared product accessors

Returns
  the squared magnitude of the difference operators for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t).

## q1T0()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q1T0 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## q1T1()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q1T1 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## q2T0()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q2T0 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## q2T1()

Math::Vector3d SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q2T1 | ( |  | ) | const

Endpoint accessors

Returns
  the motion vector [value(t0), value(t0)] for the segment endpoints p1, p2, q1, and q2, respectively.

## setDistanceEpsilon()

void SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setDistanceEpsilon | ( | double | epsilon | ) |

Algorithm epsilons. Set the epsilon values for the various member variables.

Parameters

  epsilon | the algorithm epsilon parameters for "close enough" decisions.

## setMuNuEpsilon()

void SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setMuNuEpsilon | ( | double | epsilon | ) |

Algorithm epsilons. Set the epsilon values for the various member variables.

Parameters

  epsilon | the algorithm epsilon parameters for "close enough" decisions.

## setTimePrecisionEpsilon()

void SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setTimePrecisionEpsilon | ( | double | epsilon | ) |

Algorithm epsilons. Set the epsilon values for the various member variables.

Parameters

  epsilon | the algorithm epsilon parameters for "close enough" decisions.

## setTripleProductEpsilon()

void SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setTripleProductEpsilon | ( | double | epsilon | ) |

Algorithm epsilons. Set the epsilon values for the various member variables.

Parameters

  epsilon | the algorithm epsilon parameters for "close enough" decisions.

## thicknessP()

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::thicknessP | ( |  | ) | const

Thickness accessors

Returns
  the thickness parameters for P and Q, respectively.

## thicknessQ()

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::thicknessQ | ( |  | ) | const

Thickness accessors

Returns
  the thickness parameters for P and Q, respectively.

## timePrecisionEpsilon()

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::timePrecisionEpsilon | ( |  | ) | const

Algorithm epsilons

Returns
  the algorithm epsilon parameters for "close enough" decisions.

## tripleProductEpsilon()

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::tripleProductEpsilon | ( |  | ) | const

Algorithm epsilons

Returns
  the algorithm epsilon parameters for "close enough" decisions.

## Member Data Documentation

## m_distanceEpsilon

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_distanceEpsilon

private

The algorithm epsilon parameters for "close enough" decisions.

## m_motionP1

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionP1

private

Linear motion intervals for each of the segment endpoints from t(0) to t(1).

## m_motionP2

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionP2

private

Linear motion intervals for each of the segment endpoints from t(0) to t(1).

## m_motionQ1

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionQ1

private

Linear motion intervals for each of the segment endpoints from t(0) to t(1).

## m_motionQ2

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionQ2

private

Linear motion intervals for each of the segment endpoints from t(0) to t(1).

## m_muNuEpsilon

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_muNuEpsilon

private

The algorithm epsilon parameters for "close enough" decisions.

## m_P1P2_P1Q1

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2_P1Q1

private

Dot product accessors The dot product for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t)

## m_P1P2_Q1Q2

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2_Q1Q2

private

Dot product accessors The dot product for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t)

## m_P1P2_sq

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2_sq

private

The squared magnitude of the difference operators for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t).

## m_P1P2xQ1Q2_x

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2xQ1Q2_x

private

The x, y and z components of (P2 - P1) X (Q2 - Q1).

## m_P1P2xQ1Q2_y

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2xQ1Q2_y

private

The x, y and z components of (P2 - P1) X (Q2 - Q1).

## m_P1P2xQ1Q2_z

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2xQ1Q2_z

private

The x, y and z components of (P2 - P1) X (Q2 - Q1).

## m_P1Q1_P1P2_Q1Q2

Math::PolynomialValues<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1Q1_P1P2_Q1Q2

private

The triple product of (Q1(t) - P1(t)) X (P2(t) - P1(t)) X (Q2(t) - Q1(t)) as a 3rd degree polynomial where P1, P2,Q1 and Q2 are time dependent positions for the segment endpoints.

Note
  the triple product is equivalent to 6 x the volume of tetrahedron P1P2Q1Q2.

## m_Q1Q2_P1Q1

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_Q1Q2_P1Q1

private

Dot product accessors The dot product for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t)

## m_Q1Q2_sq

Math::PolynomialValues<double, 2> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_Q1Q2_sq

private

The squared magnitude of the difference operators for time dependent vertex positions P1(t), P2(t), Q1(t) and Q2(t).

## m_relativeP1P2

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_relativeP1P2

private

Linear motion intervals for relative endpoint differences (i.e. P1Q1 indicates that the interval encodes Q1 - P1).

## m_relativeP1Q1

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_relativeP1Q1

private

Linear motion intervals for relative endpoint differences (i.e. P1Q1 indicates that the interval encodes Q1 - P1).

## m_relativeQ1Q2

Math::LinearMotionND<double, 3> SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_relativeQ1Q2

private

Linear motion intervals for relative endpoint differences (i.e. P1Q1 indicates that the interval encodes Q1 - P1).

## m_thicknessP

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_thicknessP

private

The thickness parameters for P and Q, respectively.

## m_thicknessQ

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_thicknessQ

private

The thickness parameters for P and Q, respectively.

## m_timePrecisionEpsilon

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_timePrecisionEpsilon

private

The algorithm epsilon parameters for "close enough" decisions.

## m_volumeEpsilonTimes6

double SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_volumeEpsilonTimes6

private

The algorithm epsilon parameters for "close enough" decisions.

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

- SurgSim/Collision/SegmentSegmentCcdIntervalCheck.h
- SurgSim/Collision/SegmentSegmentCcdIntervalCheck.cpp