- Timestamp:
- Jun 12, 2005, 11:52:45 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree.cc
r4609 r4611 98 98 int const length = 3; 99 99 sVec3D* vertList = new sVec3D[length]; 100 sVec3D data[length] = {{5.0, 0.0, 0.0},{2.0, 0.0, 0.5},{14.0, 0.0, 0.0}};//, {5.0, 0.0, 1.0}, {12.0, 0.0, 8.0}, {3.0, 5.0, 4.9}};100 sVec3D data[length] = {{5.0, 0.0, 0.0},{2.0, 0.0, 5.0},{14.0, 0.0, 0.0}};//, {5.0, 0.0, 1.0}, {12.0, 0.0, 8.0}, {3.0, 5.0, 4.9}}; 101 101 102 102 for(int i = 0; i < length; ++i) -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4609 r4611 279 279 280 280 /* get the closest vertex near the center */ 281 float dist = 0.0f;//!< the smallest distance to each vertex281 float dist = 999999.0f; //!< the smallest distance to each vertex 282 282 float tmpDist; //!< temporary distance 283 283 int vertexIndex; 284 Plane separationPlane(*box->axis[axisIndex], *box->center); //!< the separation plane definition284 Plane middlePlane(*box->axis[axisIndex], *box->center); //!< the middle plane 285 285 286 286 for(int i = 0; i < box->numOfVertices; ++i) 287 287 { 288 tmpDist = fabs(separationPlane.distancePoint(vertices[i])); 289 if( tmpDist > dist) 288 tmpDist = fabs(middlePlane.distancePoint(box->vertices[i])); 289 if( tmpDist < dist) 290 { 290 291 dist = tmpDist; 291 } 292 292 vertexIndex = i; 293 } 294 } 293 295 294 296 printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist); 297 298 299 /* now definin the separation plane through this specified nearest point and partition 300 the points depending on which side they are located 301 */ 302 Plane separationPlane(*box->axis[axisIndex], box->vertices[vertexIndex]); //!< separation plane 303 tList<sVec3D> partition1; //!< the vertex partition 1 304 tList<sVec3D> partition2; //!< the vertex partition 2 295 305 296 306 -
orxonox/trunk/src/lib/math/vector.cc
r4585 r4611 652 652 } 653 653 654 655 /** 656 \brief create a plane from anchor point and normal 657 \param norm: normal vector 658 \param p: anchor point 659 */ 660 Plane::Plane (Vector norm, sVec3D g) 661 { 662 Vector p(g[0], g[1], g[2]); 663 n = norm; 664 k = -(n.x*p.x+n.y*p.y+n.z*p.z); 665 } 666 667 654 668 /** 655 669 \brief returns the intersection point between the plane and a line -
orxonox/trunk/src/lib/math/vector.h
r4609 r4611 227 227 Plane (Vector a, Vector b, Vector c); 228 228 Plane (Vector norm, Vector p); 229 Plane (Vector norm, sVec3D p); 229 230 Plane (Vector n, float k) : n(n), k(k) {} //!< assignment constructor 230 231 Plane () : n(Vector(1,1,1)), k(0) {}
Note: See TracChangeset
for help on using the changeset viewer.