OPC_PlanesCollider.h
Go to the documentation of this file.
1 /*
3  * OPCODE - Optimized Collision Detection
4  * Copyright (C) 2001 Pierre Terdiman
5  * Homepage: http://www.codercorner.com/Opcode.htm
6  */
8 
10 
16 
19 // Include Guard
20 #ifndef __OPC_PLANESCOLLIDER_H__
21 #define __OPC_PLANESCOLLIDER_H__
22 
24  {
26  {
27  }
28  };
29 
31  {
32  public:
33  // Constructor / Destructor
35  virtual ~PlanesCollider();
36 
37  inline void setCollisionPairInserter(hrp::CollisionPairInserterBase* collisionPairInserter) {
38  this->collisionPairInserter = collisionPairInserter;
39  }
41 
55  bool Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const Model& model, const Matrix4x4* worldm=null);
57 
58  // Mutant box-with-planes collision queries
59  inline_ bool Collide(PlanesCache& cache, const OBB& box, const Model& model, const Matrix4x4* worldb=null, const Matrix4x4* worldm=null)
60  {
61  Plane PL[6];
62 
63  if(worldb)
64  {
65  // Create a new OBB in world space
66  OBB WorldBox;
67  box.Rotate(*worldb, WorldBox);
68  // Compute planes from the sides of the box
69  WorldBox.ComputePlanes(PL);
70  }
71  else
72  {
73  // Compute planes from the sides of the box
74  box.ComputePlanes(PL);
75  }
76 
77  // Collide with box planes
78  return Collide(cache, PL, 6, model, worldm);
79  }
80  // Settings
81 
83 
87  override(Collider) const char* ValidateSettings();
89 
90  protected:
92  // Planes in model space
95  // Leaf description
97  // Internal methods
98  void _Collide(const AABBCollisionNode* node, udword clip_mask);
99  void _Collide(const AABBNoLeafNode* node, udword clip_mask);
100  void _Collide(const AABBQuantizedNode* node, udword clip_mask);
101  void _Collide(const AABBQuantizedNoLeafNode* node, udword clip_mask);
102  void _CollideNoPrimitiveTest(const AABBCollisionNode* node, udword clip_mask);
103  void _CollideNoPrimitiveTest(const AABBNoLeafNode* node, udword clip_mask);
104  void _CollideNoPrimitiveTest(const AABBQuantizedNode* node, udword clip_mask);
105  void _CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node, udword clip_mask);
106  // Overlap tests
107  inline_ BOOL PlanesAABBOverlap(const Point& center, const Point& extents, udword& out_clip_mask, udword in_clip_mask);
108  inline_ BOOL PlanesTriOverlap(udword in_clip_mask);
109  // Init methods
110  BOOL InitQuery(PlanesCache& cache, const Plane* planes, udword nb_planes, const Matrix4x4* worldm=null);
111  };
112 
114  {
115  public:
116  // Constructor / Destructor
118  virtual ~HybridPlanesCollider();
119 
120  bool Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const HybridModel& model, const Matrix4x4* worldm=null);
121  protected:
123  };
124 
125 #endif // __OPC_PLANESCOLLIDER_H__
bool ComputePlanes(Plane *planes) const
inline_ void Rotate(const Matrix4x4 &mtx, OBB &obb) const
Definition: IceOBB.h:65
#define null
our own NULL pointer
Definition: IceTypes.h:57
hrp::CollisionPairInserterBase * collisionPairInserter
VertexPointers mVP
#define inline_
Definition: IcePoint.h:25
Definition: IcePlane.h:17
virtual inline_ void InitQuery()
Definition: OPC_Collider.h:173
#define OPCODE_API
Definition: Opcode.h:68
int BOOL
Another boolean type.
Definition: IceTypes.h:102
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
virtual const char * ValidateSettings()=0
Definition: IceOBB.h:18
inline_ bool Collide(PlanesCache &cache, const OBB &box, const Model &model, const Matrix4x4 *worldb=null, const Matrix4x4 *worldm=null)
void setCollisionPairInserter(hrp::CollisionPairInserterBase *collisionPairInserter)
bool Collide(PlanesCache &cache, const Plane *planes, udword nb_planes, const Model &model, const Matrix4x4 *worldm=null)
Definition: jquant2.c:258


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:24