Collisions against edge in 2D. More...
#include <edge_collide.h>
Inherited by NLPACS::CEdgeCollideNode.
Public Types | |
| enum | TPointMoveProblem { ParallelEdges = 0, StartOnEdge, StopOnEdge, TraverseEndPoint, EdgeNull, PointMoveProblemCount } |
Public Member Functions | |
| void | make (const CVector2f &p0, const CVector2f &p1) |
| CRational64 | testPointMove (const CVector2f &start, const CVector2f &end, TPointMoveProblem &moveBug) |
| return 1 either if no collision occurs. | |
| float | testCircleMove (const CVector2f &start, const CVector2f &delta, float radius, CVector2f &normal) |
| return 1 either if the circle moves away from the line, or no collision occurs. | |
| float | testBBoxMove (const CVector2f &start, const CVector2f &delta, const CVector2f bbox[4], CVector2f &normal) |
| return 1 either if the bbox moves away from the line, or no collision occurs. | |
| bool | testBBoxCollide (const CVector2f bbox[4]) |
| return true if this oriented bbox collide this edge. | |
Public Attributes | |
| CVector2f | P0 |
| CVector2f | P1 |
| CVector2f | Dir |
| CVector2f | Norm |
| float | A0 |
| float | A1 |
| float | C |
Private Member Functions | |
| bool | testEdgeMove (const CVector2f &q0, const CVector2f &q1, const CVector2f &delta, float &tMin, float &tMax, bool &normalOnBox) |
| test if edge collide against me. | |
Collisions against edge in 2D.
Definition at line 178 of file edge_collide.h.
Definition at line 181 of file edge_collide.h.
Definition at line 41 of file edge_collide.cpp.
References A0, A1, C, Dir, Norm, NLMISC::CVector2f::normalize(), P0, P1, NLMISC::CVector2f::x, and NLMISC::CVector2f::y.
Referenced by NLPACS::CLocalRetriever::testCollision(), and NLPACS::CRetrieverInstance::testExteriorCollision().
return true if this oriented bbox collide this edge.
| bbox | 4 points of the bbox, in CCW. |
Definition at line 654 of file edge_collide.cpp.
References P0, P1, and NLMISC::CVector2f::x.
Referenced by NLPACS::CGlobalRetriever::testRotCollisionWithCollisionChains().
| float NLPACS::CEdgeCollide::testBBoxMove | ( | const CVector2f & | start, | |
| const CVector2f & | delta, | |||
| const CVector2f | bbox[4], | |||
| CVector2f & | normal | |||
| ) |
return 1 either if the bbox moves away from the line, or no collision occurs.
Else return a [0,1[ interval. If collision occurs (ie return<1), return in "normal" the normal of the collision. It may be normal of edge (+-), or normal against a point of the edge.
| bbox | 4 points of the bbox at start. start must be the barycentre of those points. |
Definition at line 556 of file edge_collide.cpp.
References C, min, Norm, testEdgeMove(), NLMISC::CVector2f::x, and NLMISC::CVector2f::y.
Referenced by NLPACS::CGlobalRetriever::testCollisionWithCollisionChains().
| float NLPACS::CEdgeCollide::testCircleMove | ( | const CVector2f & | start, | |
| const CVector2f & | delta, | |||
| float | radius, | |||
| CVector2f & | normal | |||
| ) |
return 1 either if the circle moves away from the line, or no collision occurs.
Else return a [0,1[ interval. If collision occurs (ie return<1), return in "normal" the normal of the collision. It may be normal of edge (+-), or normal against a point of the edge.
Definition at line 264 of file edge_collide.cpp.
References A0, A1, C, Dir, NLMISC::CVector2f::isNull(), min, Norm, NLMISC::CVector2f::normalize(), P0, P1, and NLPACS::testCirclePoint().
Referenced by NLPACS::CGlobalRetriever::testCollisionWithCollisionChains().
| bool NLPACS::CEdgeCollide::testEdgeMove | ( | const CVector2f & | q0, | |
| const CVector2f & | q1, | |||
| const CVector2f & | delta, | |||
| float & | tMin, | |||
| float & | tMax, | |||
| bool & | normalOnBox | |||
| ) | [private] |
test if edge collide against me.
if true, return time intervals of collisions (]-oo, +oo[). NB: for simplicity, if lines are //, return false.
Definition at line 391 of file edge_collide.cpp.
References NLPACS::EdgeCollideEpsilon, min, NLMISC::CVector2f::norm(), P0, P1, NLMISC::CVector2d::sqrnorm(), NLMISC::CVector2d::x, and NLMISC::CVector2d::y.
Referenced by testBBoxMove().
| CRational64 NLPACS::CEdgeCollide::testPointMove | ( | const CVector2f & | start, | |
| const CVector2f & | end, | |||
| TPointMoveProblem & | moveBug | |||
| ) |
return 1 either if no collision occurs.
Else return a [0,1[ interval. return -1 if precision problem (see below). This method is used by CGlobalRetriever::doMove(). UnManageables cases arise when:
Definition at line 58 of file edge_collide.cpp.
References EdgeNull, NLMISC::fsgn(), nlassert, P0, P1, ParallelEdges, StartOnEdge, StopOnEdge, TraverseEndPoint, NLMISC::CVector2f::x, and NLMISC::CVector2f::y.
Referenced by NLPACS::CGlobalRetriever::testMovementWithCollisionChains().
Definition at line 188 of file edge_collide.h.
Referenced by make(), and testCircleMove().
Definition at line 188 of file edge_collide.h.
Referenced by make(), and testCircleMove().
Definition at line 189 of file edge_collide.h.
Referenced by make(), testBBoxMove(), and testCircleMove().
Definition at line 187 of file edge_collide.h.
Referenced by make(), and testCircleMove().
Definition at line 187 of file edge_collide.h.
Referenced by make(), testBBoxMove(), testCircleMove(), and NLPACS::CGlobalRetriever::testMovementWithCollisionChains().
Definition at line 185 of file edge_collide.h.
Referenced by make(), testBBoxCollide(), testCircleMove(), testEdgeMove(), and testPointMove().
Definition at line 186 of file edge_collide.h.
Referenced by make(), testBBoxCollide(), testCircleMove(), testEdgeMove(), and testPointMove().
1.6.1