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__
VertexPointers
Definition: OPC_MeshInterface.h:23
Matrix4x4
Definition: IceMatrix4x4.h:21
VolumeCollider
Definition: OPC_VolumeCollider.h:32
Container
Definition: IceContainer.h:25
Collider::InitQuery
virtual inline_ void InitQuery()
Definition: OPC_Collider.h:173
PlanesCollider::Collide
inline_ bool Collide(PlanesCache &cache, const OBB &box, const Model &model, const Matrix4x4 *worldb=null, const Matrix4x4 *worldm=null)
Definition: OPC_PlanesCollider.h:59
box
Definition: jquant2.c:258
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
BOOL
int BOOL
Another boolean type.
Definition: IceTypes.h:102
HybridModel
Definition: OPC_HybridModel.h:46
PlanesCollider::mVP
VertexPointers mVP
Definition: OPC_PlanesCollider.h:96
Collider::ValidateSettings
virtual const char * ValidateSettings()=0
Collider::Collider
Collider()
Definition: OPC_Collider.cpp:40
PlanesCollider::setCollisionPairInserter
void setCollisionPairInserter(hrp::CollisionPairInserterBase *collisionPairInserter)
Definition: OPC_PlanesCollider.h:37
PlanesCollider
Definition: OPC_PlanesCollider.h:30
AABBCollisionNode
Definition: OPC_OptimizedTree.h:76
OBB::ComputePlanes
bool ComputePlanes(Plane *planes) const
Definition: IceOBB.cpp:82
AABBNoLeafNode
Definition: OPC_OptimizedTree.h:116
PlanesCache
Definition: OPC_PlanesCollider.h:23
VolumeCache
Definition: OPC_VolumeCollider.h:23
AABBQuantizedNoLeafNode
Definition: OPC_OptimizedTree.h:121
PlanesCollider::mNbPlanes
udword mNbPlanes
Definition: OPC_PlanesCollider.h:93
PlanesCache::PlanesCache
PlanesCache()
Definition: OPC_PlanesCollider.h:25
PlanesCollider::collisionPairInserter
hrp::CollisionPairInserterBase * collisionPairInserter
Definition: OPC_PlanesCollider.h:91
OBB
Definition: IceOBB.h:18
Model
Definition: OPC_Model.h:23
OPCODE_API
#define OPCODE_API
Definition: Opcode.h:68
HybridPlanesCollider::mTouchedBoxes
Container mTouchedBoxes
Definition: OPC_PlanesCollider.h:122
Point
Definition: IcePoint.h:25
Plane
Definition: IcePlane.h:17
AABBQuantizedNode
Definition: OPC_OptimizedTree.h:100
hrp::CollisionPairInserterBase
Definition: CollisionPairInserterBase.h:27
PlanesCollider::Collide
bool Collide(PlanesCache &cache, const Plane *planes, udword nb_planes, const Model &model, const Matrix4x4 *worldm=null)
Definition: OPC_PlanesCollider.cpp:104
HybridPlanesCollider
Definition: OPC_PlanesCollider.h:113
inline_
#define inline_
Definition: IcePreprocessor.h:103
PlanesCollider::mPlanes
Plane * mPlanes
Definition: OPC_PlanesCollider.h:94


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03