GetAllSegments

const std::vector< std::pair< Line, Line > *> &GetAllSegments()

Returns all pairs of colliding segments. The first line of each pair is colliding with the second line of the pair.

There might be more than one collision point in some cases, if several parts of the objects collide at the same time.

Examples

Collision collision = ...;

// Get all colliding segments //
const std::vector< std::pair< LineLine > *> &segments = collision.GetAllSegments();

// Draw the colliding segments //
// (Object A's colliding segments will be green and Object B's red) //

for( std::vector< std::pair< LineLine > *> ::const_iterator iter = segments.begin(); iter != segments.end(); iter++ ) {
  (*iter)->first.DrawRgba::GREEN );
  (*iter)->second.DrawRgba::RED );
}


Other functions of the class Collision
GetPoint
Returns the exact point of the collision
GetSegment
Returns the specified colliding line segment
IsCollision
Returns true if a collision has really happened
GetNormal
Returns the normal of a colliding object at the collision point
GetAllPoints
Returns all collision points
GetAllSegments
Returns all pairs of colliding segments


Questions about GetAllSegments? Click here.