Changeset 4553 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 8, 2005, 11:59:09 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/collision_detection
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/bv_tree.h
r4550 r4553 8 8 #define _BV_TREE_H 9 9 10 10 11 #include "base_object.h" 12 #include "abstract_model.h" 11 13 12 14 // FORWARD DEFINITION … … 21 23 virtual ~BVTree(); 22 24 23 virtual void spawnBVTree(int depth );24 virtual void flushTree() ;25 virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length) = NULL; 26 virtual void flushTree() = NULL; 25 27 26 BoundingVolume* getBV(int index) const;27 28 virtual void collideWith(const BVTree &tree);29 28 30 virtual void drawBV(int currentDepth, const int depth) const ;31 virtual void drawBVPolygon(int currentDepth, const int depth) const ;32 virtual void drawBVBlended(int currentDepth, const int depth) const ;29 virtual void drawBV(int currentDepth, const int depth) const = NULL; 30 virtual void drawBVPolygon(int currentDepth, const int depth) const = NULL; 31 virtual void drawBVBlended(int currentDepth, const int depth) const = NULL; 33 32 34 33 protected: … … 36 35 37 36 private: 38 BoundingVolume* firstElement; 37 39 38 40 39 }; -
orxonox/trunk/src/lib/collision_detection/obb_tree.cc
r4551 r4553 93 93 94 94 /* generate some test vertices */ 95 sVec3D vertList[] = {{1.0, 3.0, 4.0},{3.5, 6.2, 9.6},{6.4, 9.0, 2.0}}; 95 sVec3D* vertList = new sVec3D[3]; 96 sVec3D data[] = {{0.0, 0.0, 0.0},{5.0, 0.0, 10.0},{-5.0, 0.0, 10.0}}; 97 98 for(int i = 0; i < 3; ++i) 99 { 100 vertList[i][0] = data[i][0]; 101 vertList[i][1] = data[i][1]; 102 vertList[i][2] = data[i][2]; 103 } 96 104 97 105 this->spawnBVTree(1, vertList, 3); -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4551 r4553 64 64 float covariance[3][3]; //!< the covariance matrix 65 65 66 this->numOfVertices = length; 67 this->vertices = verticesList; 68 66 69 /* fist compute all the convex hull face/facelets and centroids */ 67 70 for(int i = 0; i < length; i+=3) /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/ 68 71 { 69 p = *(verticesList + i);70 q = *(verticesList + i + 1);71 r = *(verticesList + i + 2);72 p = verticesList[i]; 73 q = verticesList[i +1]; 74 r = verticesList[i + 2]; 72 75 73 76 t1 = p - q; t2 = p - r; … … 94 97 for(int i = 0; i < length; i+=3) 95 98 { 96 p = *(verticesList + i);97 q = *(verticesList + i + 1);98 r = *(verticesList + i + 2);99 p = verticesList[i]; 100 q = verticesList[i +1]; 101 r = verticesList[i + 2]; 99 102 100 103 covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j]* p[k] + … … 105 108 106 109 printf("Covariance Matrix:\n"); 107 110 for(int j = 0; j < 3; ++j) 108 111 { 109 112 printf(" |"); … … 114 117 printf(" |\n"); 115 118 } 119 printf("center: %f, %f, %f\n\n", centre.x, centre.y, centre.z); 120 121 for(int i = 0; i < length; i++) 122 { 123 printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]); 124 } 125 116 126 } 117 127 … … 122 132 123 133 void OBBTreeNode::drawBV(int currentDepth, const int depth) const 124 {} 134 { 135 glColor3f(1.0, 1.0, 1.0); 136 glBegin(GL_TRIANGLES); 137 for(int i = 0; i < this->numOfVertices; ++i) 138 { 139 glVertex3f(this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]); 140 //printf("v(%f, %f, %f)\n", this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]); 141 } 142 glEnd(); 143 } 125 144 126 145 -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.h
r4550 r4553 44 44 private: 45 45 unsigned int treeIndex; //!< Index number of the BV in the tree 46 sVec3D* vertices; //!< pointer to the vertices data 47 int numOfVertices; //!< number of vertices in vertices data 46 48 47 49 };
Note: See TracChangeset
for help on using the changeset viewer.