Changeset 4589 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 10, 2005, 11:42:38 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/collision_detection
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree.cc
r4588 r4589 96 96 97 97 /* generate some test vertices */ 98 sVec3D* vertList = new sVec3D[4]; 99 sVec3D data[] = {{0.0, 0.0, 0.0},{2.0, -8.0, 5.0},{10.0, 5.0, 0.0}, {5.0, 4.0, 1.0}}; 98 int const length = 5; 99 sVec3D* vertList = new sVec3D[length]; 100 sVec3D data[length] = {{5.0, 0.0, 0.0},{2.0, -8.0, 5.0},{14.0, 5.0, 0.0}, {5.0, 4.0, 1.0}, {12.0, 2.0, 8.0}}; 100 101 101 for(int i = 0; i < 4; ++i)102 for(int i = 0; i < length; ++i) 102 103 { 103 104 vertList[i][0] = data[i][0]; … … 106 107 } 107 108 108 this->spawnBVTree(1, vertList, 4);109 this->spawnBVTree(1, vertList, length); 109 110 110 111 PRINT(0)("= Spawning Tree: Finished\n"); -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4588 r4589 217 217 float tmpLength; //!< tmp save point for the length 218 218 219 ax[0].r = *box->center; ax[0].a = *box->axis[0];220 ax[1].r = *box->center; ax[1].a = *box->axis[1];221 ax[2].r = *box->center; ax[2].a = *box->axis[2];222 219 223 220 Plane p0(*box->axis[0], *box->center); … … 225 222 Plane p2(*box->axis[2], *box->center); 226 223 227 228 229 halfLength[0] = 0.0f; 224 halfLength[0] = -1.0f; 230 225 for(int j = 0; j < length; ++j) 231 226 { 232 tmpLength = p0.distancePoint(vertices[j]);227 tmpLength = fabs(p0.distancePoint(vertices[j])); 233 228 if( tmpLength > halfLength[0]) 234 229 halfLength[0] = tmpLength; 235 230 } 236 231 237 238 halfLength[1] = 0.0f; 232 halfLength[1] = -1.0f; 239 233 for(int j = 0; j < length; ++j) 240 234 { 241 tmpLength = p1.distancePoint(vertices[j]);235 tmpLength = fabs(p1.distancePoint(vertices[j])); 242 236 if( tmpLength > halfLength[1]) 243 237 halfLength[1] = tmpLength; 244 238 } 245 239 246 halfLength[2] = 0.0f;240 halfLength[2] = -1.0f; 247 241 for(int j = 0; j < length; ++j) 248 242 { 249 tmpLength = p2.distancePoint(vertices[j]);243 tmpLength = fabs(p2.distancePoint(vertices[j])); 250 244 if( tmpLength > halfLength[2]) 251 245 halfLength[2] = tmpLength; … … 253 247 254 248 box->halfLength = halfLength; 255 256 249 257 250 … … 300 293 void OBBTreeNode::drawBVPolygon(int currentDepth, const int depth) const 301 294 { 295 296 /* draw world axes */ 297 glBegin(GL_LINES); 298 glColor3f(0.0, 0.4, 0.3); 299 glVertex3f(0.0, 0.0, 0.0); 300 glVertex3f(3.0, 0.0, 0.0); 301 302 glVertex3f(0.0, 0.0, 0.0); 303 glVertex3f(0.0, 3.0, 0.0); 304 305 glVertex3f(0.0, 0.0, 0.0); 306 glVertex3f(0.0, 0.0, 3.0); 307 glEnd(); 308 309 302 310 303 311 /* draw the obb axes */
Note: See TracChangeset
for help on using the changeset viewer.