OpenLayer Offline Manual

OpenLayer | Collision | GetAllSegments 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< Line, Line > *> &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< Line, Line > *> ::const_iterator iter = segments.begin(); iter != segments.end(); iter++ ) { (*iter)->first.Draw( Rgba::GREEN ); (*iter)->second.Draw( Rgba::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
Back to the main page of the manual Questions about GetAllSegments? Click here.