Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SurgSim::Collision::SegmentSegmentCcdStaticContact Class Reference

SegmentSegmentCcdStaticContact computes if there is contact between two segments at a specific point in time in support of the CCD calculations for moving intervals. More...

#include <SurgSim/Collision/SegmentSegmentCcdStaticContact.h>

Public Types

enum  SegmentCcdEdgeType {
  SegmentCcdEdgeTypeR0, SegmentCcdEdgeTypeR1, SegmentCcdEdgeTypeS0, SegmentCcdEdgeTypeS1,
  SegmentCcdEdgeTypeEdgeSkip, SegmentCcdEdgeTypeEdgeInvalid
}
 

Public Member Functions

 SegmentSegmentCcdStaticContact ()
 Constructor. More...
 
bool collideStaticSegmentSegment (const std::array< SurgSim::Math::Vector3d, 2 > &p, const std::array< SurgSim::Math::Vector3d, 2 > &q, double distanceEpsilon, double *r, double *s)
 Determine whether two "zero radius" segments collide. More...
 
bool collideStaticSegmentSegment (const std::array< SurgSim::Math::Vector3d, 2 > &p, const std::array< SurgSim::Math::Vector3d, 2 > &q, double radiusP, double radiusQ, double *r, double *s)
 Determine whether two thick segments collide. More...
 

Protected Member Functions

bool collideStaticPointSegment (const Math::Vector3d &point, const std::array< SurgSim::Math::Vector3d, 2 > &p, double thicknessPoint, double thicknessSegment, double *r)
 Determine whether a single point and a segment collide. More...
 
SegmentCcdEdgeType computeCollisionEdge (double a, double b, double d, double r, double s, double ratio) const
 Find the edge to be clamped for the closest point solution using the outline of: https://www.assembla.com/spaces/OpenSurgSim/documents/cRWomWC2er5ykpacwqjQYw/download/cRWomWC2er5ykpacwqjQYw. More...
 
void computeCollisionParametrics (SegmentCcdEdgeType edge, double a, double b, double c, double d, double e, double ratio, double *r, double *s) const
 Given an edge indicator, clamp the indicated parametric edge and calculate the minimum parametric value for the other segment using the outline of: https://www.assembla.com/spaces/OpenSurgSim/documents/cRWomWC2er5ykpacwqjQYw/download/cRWomWC2er5ykpacwqjQYw Definitions of the values are: a = (P1 - P0)(P1 - P0) b = -(P1 - P0)(Q1 - Q0) c = (Q1 - Q0)(Q1 - Q0) d = (P1 - P0)(P0 - Q0) e = -(Q1 - Q0)(P0 - Q0) f = (P0 - Q0)(P0 - Q0) More...
 
void computeParallelSegmentParametrics (double a, double b, double d, double *r, double *s) const
 Calculate the parametric values that give the minimum distance for two parallel segments value for the other edge. More...
 

Private Attributes

const double m_degenerateEpsilon
 During collision, points closer than this value are considered a single point. More...
 

Detailed Description

SegmentSegmentCcdStaticContact computes if there is contact between two segments at a specific point in time in support of the CCD calculations for moving intervals.

Algorithm optimizations improve performance for specific orientations and positions of segments such as parallel segments, or segments where the closest approach is at one or both of the segment endpoints.

See also
SegmentSegmentCcdIntervalCheck

Member Enumeration Documentation

§ SegmentCcdEdgeType

Enumerator
SegmentCcdEdgeTypeR0 
SegmentCcdEdgeTypeR1 
SegmentCcdEdgeTypeS0 
SegmentCcdEdgeTypeS1 
SegmentCcdEdgeTypeEdgeSkip 
SegmentCcdEdgeTypeEdgeInvalid 

Constructor & Destructor Documentation

§ SegmentSegmentCcdStaticContact()

SurgSim::Collision::SegmentSegmentCcdStaticContact::SegmentSegmentCcdStaticContact ( )

Constructor.

Member Function Documentation

§ collideStaticPointSegment()

bool SurgSim::Collision::SegmentSegmentCcdStaticContact::collideStaticPointSegment ( const Math::Vector3d point,
const std::array< SurgSim::Math::Vector3d, 2 > &  p,
double  thicknessPoint,
double  thicknessSegment,
double *  r 
)
protected

Determine whether a single point and a segment collide.

Parameters
pointpoint position.
psegment endpoints.
thicknessPointradius of the point.
thicknessSegmentradius of the segment.
r[out] parametric location of the collision point (if any) on segment p.
Returns
false if no collision is occurring, or true otherwise.

§ collideStaticSegmentSegment() [1/2]

bool SurgSim::Collision::SegmentSegmentCcdStaticContact::collideStaticSegmentSegment ( const std::array< SurgSim::Math::Vector3d, 2 > &  p,
const std::array< SurgSim::Math::Vector3d, 2 > &  q,
double  distanceEpsilon,
double *  r,
double *  s 
)

Determine whether two "zero radius" segments collide.

For moving segments, this represents contact at a specific point in time.

Parameters
psegment 1 endpoints.
qsegment 2 endpoints.
distanceEpsiloncloseness parameter for the zero thickness collision.
r[out] parametric location of the collision point (if any) on segment 1.
s[out] parametric location of the collision point (if any) on segment 2.
Returns
false if no collision is occurring, or true otherwise.

§ collideStaticSegmentSegment() [2/2]

bool SurgSim::Collision::SegmentSegmentCcdStaticContact::collideStaticSegmentSegment ( const std::array< SurgSim::Math::Vector3d, 2 > &  p,
const std::array< SurgSim::Math::Vector3d, 2 > &  q,
double  radiusP,
double  radiusQ,
double *  r,
double *  s 
)

Determine whether two thick segments collide.

For moving segments, this represents contact at a specific point in time.

Parameters
psegment 1 endpoints.
qsegment 2 endpoints.
radiusPthickness of segment 1.
radiusQthickness of segment 2.
r[out] parametric location of the collision point (if any) on segment 1.
s[out] parametric location of the collision point (if any) on segment 2.
Returns
false if no collision is occurring, or true otherwise.

§ computeCollisionEdge()

SegmentSegmentCcdStaticContact::SegmentCcdEdgeType SurgSim::Collision::SegmentSegmentCcdStaticContact::computeCollisionEdge ( double  a,
double  b,
double  d,
double  r,
double  s,
double  ratio 
) const
protected

Find the edge to be clamped for the closest point solution using the outline of: https://www.assembla.com/spaces/OpenSurgSim/documents/cRWomWC2er5ykpacwqjQYw/download/cRWomWC2er5ykpacwqjQYw.

Calculates the parametric value that must be clamped in determining the segment - segment distance where: SegmentCcdEdgeTypeR0 clamp parametric value r to 0 SegmentCcdEdgeTypeR1 clamp parametric value r to 1 SegmentCcdEdgeTypeS0 clamp parametric value s to 0 SegmentCcdEdgeTypeS1 clamp parametric value s to 1 SegmentCcdEdgeSkip both values are with [0, 1] a = (P1 - P0)(P1 - P0) b = -(P1 - P0)(Q1 - Q0) c = (Q1 - Q0)(Q1 - Q0) d = (P1 - P0)(P0 - Q0) e = -(Q1 - Q0)(P0 - Q0) f = (P0 - Q0)(P0 - Q0)

Parameters
avalue of p dot p
bvalue of -(p dot q)
dvalue of p dot (q[0] - p[0])
runnormalized parametric location of the intersection point on line p
sunnormalized parametric location of the intersection point on line q
rationormalization value defined as (p dot p) . (q dot q) - (p dot q)^2.
Returns
an indicator of the edge (r and s) which must be clamped and its clamp value.

§ computeCollisionParametrics()

void SurgSim::Collision::SegmentSegmentCcdStaticContact::computeCollisionParametrics ( SegmentCcdEdgeType  edge,
double  a,
double  b,
double  c,
double  d,
double  e,
double  ratio,
double *  r,
double *  s 
) const
protected

Given an edge indicator, clamp the indicated parametric edge and calculate the minimum parametric value for the other segment using the outline of: https://www.assembla.com/spaces/OpenSurgSim/documents/cRWomWC2er5ykpacwqjQYw/download/cRWomWC2er5ykpacwqjQYw Definitions of the values are: a = (P1 - P0)(P1 - P0) b = -(P1 - P0)(Q1 - Q0) c = (Q1 - Q0)(Q1 - Q0) d = (P1 - P0)(P0 - Q0) e = -(Q1 - Q0)(P0 - Q0) f = (P0 - Q0)(P0 - Q0)

Parameters
edgeindicator of previously calculated edge constraint
avalue of p dot p
bvalue of -(p dot q)
cvalue of q dot q
dvalue of p dot (p[0] - q[0])
evalue of -(q dot (p[0] - q[0]))
rationormalization value defined as (p dot p) . (q dot q) - (p dot q)^2.
r[out] parametric location of the intersection point on segment p
s[out] parametric location of the intersection point on segment q

§ computeParallelSegmentParametrics()

void SurgSim::Collision::SegmentSegmentCcdStaticContact::computeParallelSegmentParametrics ( double  a,
double  b,
double  d,
double *  r,
double *  s 
) const
protected

Calculate the parametric values that give the minimum distance for two parallel segments value for the other edge.

Definitions of the values are: a = (P1 - P0)(P1 - P0) b = -(P1 - P0)(Q1 - Q0) c = (Q1 - Q0)(Q1 - Q0) d = (P1 - P0)(P0 - Q0) e = -(Q1 - Q0)(P0 - Q0) f = (P0 - Q0)(P0 - Q0)

Parameters
avalue of p dot p
bvalue of -(p dot q)
dvalue of p dot (p[0] - q[0])
r[out] parametric location of the intersection point on segment p
s[out] parametric location of the intersection point on segment q

Member Data Documentation

§ m_degenerateEpsilon

const double SurgSim::Collision::SegmentSegmentCcdStaticContact::m_degenerateEpsilon
private

During collision, points closer than this value are considered a single point.


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