Changeset 4560 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jun 9, 2005, 12:21:08 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/collision_detection
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/bounding_volume.cc
r4557 r4560 17 17 18 18 #include "bounding_volume.h" 19 #include "vector.h" 19 20 20 21 using namespace std; -
orxonox/trunk/src/lib/collision_detection/bounding_volume.h
r4557 r4560 24 24 inline const Vector* getCenter() const { return this->center; } 25 25 26 virtual tList<sVect3D>* getVertices() const = NULL;26 virtual sVect3D* getVertices() const = NULL; 27 27 virtual void mergeWith(const BoundingVolume &bv) = NULL; 28 28 … … 32 32 33 33 34 p rotected:34 public: 35 35 Vector* center; //!< Center point of box 36 36 -
orxonox/trunk/src/lib/collision_detection/obb.h
r4557 r4560 22 22 23 23 inline const Vector* getAxis () const { return this->axis; } 24 inline const sVect3D* getHalfLength() const { return this->halfLength; }24 inline const float* getHalfLength() const { return this->halfLength; } 25 25 26 virtual tList<sVect3D>* getVertices() const { return this->verticesBuffer; }26 virtual sVect3D* getVertices() const { return this->vertices; } 27 27 virtual void mergeWith(const BoundingVolume &bv); 28 28 -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4557 r4560 56 56 { 57 57 this->bvElement = this->createBox(); 58 this->calculateBoxAttributes( box);59 this->forkBox( box);58 this->calculateBoxAttributes(this->bvElement, verticesList, length); 59 this->forkBox(this->bvElement); 60 60 } 61 61 … … 67 67 68 68 69 void OBBTreeNode::calculateBoxAttributes(OBB* box )69 void OBBTreeNode::calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length) 70 70 { 71 71 float facelet[length]; //!< surface area of the i'th triangle of the convex hull … … 75 75 Vector p, q, r; //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d 76 76 Vector t1, t2; //!< temporary values 77 float covariance[3][3];//!< the covariance matrix77 float** covariance; //!< the covariance matrix 78 78 79 79 this->numOfVertices = length; … … 130 130 printf(" |\n"); 131 131 } 132 printf("center: %f, %f, %f\n\n", cent re.x, centre.y, centre.z);132 printf("center: %f, %f, %f\n\n", center.x, center.y, center.z); 133 133 134 134 for(int i = 0; i < length; i++) … … 137 137 } 138 138 139 139 140 for(int i = 0; i < 3; ++i) 141 { 140 142 141 box->covarianceMatrix = covariance; 142 box->center = center; 143 box->covarianceMatrix[i][0] = covariance[i][0]; 144 box->covarianceMatrix[i][1] = covariance[i][1]; 145 box->covarianceMatrix[i][3] = covariance[i][2]; 146 } 147 *box->center = center; 143 148 144 149 … … 161 166 for(int i = 0; i < 3; ++i) 162 167 { 163 if( aLength < box->axis[i] )168 if( aLength < box->axis[i].len()) 164 169 { 165 aLength = box->axis[i] ;170 aLength = box->axis[i].len(); 166 171 axisNr = i; 167 172 } … … 194 199 this->bvElement->axis; 195 200 196 glBegin(GL_TRIANGLE);197 glVertex3f(this->bvElement->center );198 glEnd();201 //glBegin(GL_TRIANGLE); 202 //glVertex3f(this->bvElement->center ); 203 //glEnd(); 199 204 } 200 205 -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.h
r4557 r4560 27 27 virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length); 28 28 29 BoundingVolume* getBV(int index) const { return this->bvElement; }29 BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; } 30 30 inline const int getIndex() { return this->treeIndex; } 31 31 … … 38 38 private: 39 39 OBB* createBox(); 40 void calculateBoxAttributes(OBB* box );40 void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length); 41 41 void forkBox(OBB* box); 42 42 43 43 44 45 44 protected: 46 BoundingVolume* bvElement;45 OBB* bvElement; 47 46 OBBTreeNode* nodeLeft; 48 47 OBBTreeNode* nodeRight;
Note: See TracChangeset
for help on using the changeset viewer.