00001 //=========================================================================== 00002 /* 00003 This file is part of the CHAI 3D visualization and haptics libraries. 00004 Copyright (C) 2003-2009 by CHAI 3D. All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License("GPL") version 2 00008 as published by the Free Software Foundation. 00009 00010 For using the CHAI 3D libraries with software that can not be combined 00011 with the GNU GPL, and for taking advantage of the additional benefits 00012 of our support services, please contact CHAI 3D about acquiring a 00013 Professional Edition License. 00014 00015 \author <http://www.chai3d.org> 00016 \author Chris Sewell 00017 \author Francois Conti 00018 \version 2.0.0 $Rev: 251 $ 00019 */ 00020 //=========================================================================== 00021 00022 //--------------------------------------------------------------------------- 00023 #ifndef CCollisionAABBH 00024 #define CCollisionAABBH 00025 //--------------------------------------------------------------------------- 00026 #include "graphics/CTriangle.h" 00027 #include "graphics/CVertex.h" 00028 #include "math/CMaths.h" 00029 #include "collisions/CGenericCollision.h" 00030 #include "collisions/CCollisionAABBBox.h" 00031 #include "collisions/CCollisionAABBTree.h" 00032 #include <vector> 00033 //--------------------------------------------------------------------------- 00034 00035 //=========================================================================== 00043 //=========================================================================== 00044 00045 //=========================================================================== 00055 //=========================================================================== 00056 class cCollisionAABB : public cGenericCollision 00057 { 00058 public: 00059 00060 //----------------------------------------------------------------------- 00061 // CONSTRUCTOR & DESTRUCTOR: 00062 //----------------------------------------------------------------------- 00063 00065 cCollisionAABB(vector<cTriangle>* a_triangles, bool a_useNeighbors); 00066 00068 virtual ~cCollisionAABB(); 00069 00070 00071 //----------------------------------------------------------------------- 00072 // METHODS: 00073 //----------------------------------------------------------------------- 00074 00076 void initialize(double a_radius = 0); 00077 00079 void render(); 00080 00082 bool computeCollision(cVector3d& a_segmentPointA, cVector3d& a_segmentPointB, 00083 cCollisionRecorder& a_recorder, cCollisionSettings& a_settings); 00084 00086 cCollisionAABBNode* getRoot() { return (m_root); } 00087 00088 00089 protected: 00090 00091 //----------------------------------------------------------------------- 00092 // MEMBERS: 00093 //----------------------------------------------------------------------- 00094 00096 vector<cTriangle> *m_triangles; 00097 00099 cCollisionAABBLeaf *m_leaves; 00100 00102 cCollisionAABBInternal *m_internalNodes; 00103 00105 cCollisionAABBNode *m_root; 00106 00108 unsigned int m_numTriangles; 00109 00111 cTriangle* m_lastCollision; 00112 00114 bool m_useNeighbors; 00115 }; 00116 00117 //--------------------------------------------------------------------------- 00118 #endif 00119 //---------------------------------------------------------------------------