# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLPACS::CEdgeCollide Class Reference

Collisions against edge in 2D. More...

#include <edge_collide.h>

Inheritance diagram for NLPACS::CEdgeCollide:

NLPACS::CEdgeCollideNode List of all members.

Public Types

enum  TPointMoveProblem {
  ParallelEdges = 0, StartOnEdge, StopOnEdge, TraverseEndPoint,
  EdgeNull, PointMoveProblemCount
}

Public Methods

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. More...

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. More...

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. More...

bool testBBoxCollide (const CVector2f bbox[4])
 return true if this oriented bbox collide this edge. More...


Public Attributes

CVector2f P0
CVector2f P1
CVector2f Dir
CVector2f Norm
float A0
float A1
float C

Private Methods

bool testEdgeMove (const CVector2f &q0, const CVector2f &q1, const CVector2f &delta, float &tMin, float &tMax, bool &normalOnBox)
 test if edge collide against me. More...


Detailed Description

Collisions against edge in 2D.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 180 of file edge_collide.h.


Member Enumeration Documentation

enum NLPACS::CEdgeCollide::TPointMoveProblem
 

Enumeration values:
ParallelEdges 
StartOnEdge 
StopOnEdge 
TraverseEndPoint 
EdgeNull 
PointMoveProblemCount 

Definition at line 183 of file edge_collide.h.


Member Function Documentation

void NLPACS::CEdgeCollide::make const CVector2f &    p0,
const CVector2f &    p1
 

Definition at line 43 of file edge_collide.cpp.

References A0, A1, C, Dir, Norm, P0, and P1.

bool NLPACS::CEdgeCollide::testBBoxCollide const CVector2f    bbox[4]
 

return true if this oriented bbox collide this edge.

Parameters:
bbox  4 points of the bbox, in CCW.
Returns:
true if collision occurs.

Definition at line 634 of file edge_collide.cpp.

References P0, and P1.

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.

Parameters:
bbox  4 points of the bbox at start. start must be the barycentre of those points.

Definition at line 536 of file edge_collide.cpp.

References C, min, Norm, and testEdgeMove.

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 250 of file edge_collide.cpp.

References A0, A1, C, Dir, min, Norm, P0, P1, t, and NLPACS::testCirclePoint.

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 371 of file edge_collide.cpp.

References NLPACS::EdgeCollideEpsilon, min, P0, and P1.

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:

  • the movement start/stop on a edge (dist==0). In this case, don't know on what surface we arrive (before or after).
  • the movement is // to the edge and collide with it. same problem than stop on an edge.
  • the movement traverse the edge on an endpoint. In this case, there is 2+ edges sharing the point, and result is undefined. On thoses cases, moveBug is filled, and -1 is returned.

Definition at line 60 of file edge_collide.cpp.

References EdgeNull, NLMISC::fsgn, nlassert, nlwarning, P0, P1, ParallelEdges, StartOnEdge, StopOnEdge, and TraverseEndPoint.


Member Data Documentation

float NLPACS::CEdgeCollide::A0
 

Definition at line 190 of file edge_collide.h.

Referenced by make, and testCircleMove.

float NLPACS::CEdgeCollide::A1
 

Definition at line 190 of file edge_collide.h.

Referenced by make, and testCircleMove.

float NLPACS::CEdgeCollide::C
 

Definition at line 191 of file edge_collide.h.

Referenced by make, testBBoxMove, and testCircleMove.

CVector2f NLPACS::CEdgeCollide::Dir
 

Definition at line 189 of file edge_collide.h.

Referenced by make, and testCircleMove.

CVector2f NLPACS::CEdgeCollide::Norm
 

Definition at line 189 of file edge_collide.h.

Referenced by make, testBBoxMove, and testCircleMove.

CVector2f NLPACS::CEdgeCollide::P0
 

Definition at line 187 of file edge_collide.h.

Referenced by make, testBBoxCollide, testCircleMove, testEdgeMove, and testPointMove.

CVector2f NLPACS::CEdgeCollide::P1
 

Definition at line 188 of file edge_collide.h.

Referenced by make, testBBoxCollide, testCircleMove, testEdgeMove, and testPointMove.


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