- Timestamp:
- May 11, 2006, 12:06:06 AM (19 years ago)
- Location:
- branches/cd/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cd/src/lib/collision_detection/obb_tree_node.cc
r7582 r7583 299 299 float maxLength[3]; //!< maximal lenth of the axis 300 300 float minLength[3]; //!< minimal length of the axis 301 const sVec3D* tmpVec; //!< variable taking tmp vectors301 const float* tmpVec; //!< variable taking tmp vectors 302 302 303 303 304 304 /* get the maximal dimensions of the body in all directions */ 305 305 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 306 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);307 maxLength[0] = p0.distancePoint( *tmpVec);308 minLength[0] = p0.distancePoint( *tmpVec);306 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 307 maxLength[0] = p0.distancePoint(tmpVec); 308 minLength[0] = p0.distancePoint(tmpVec); 309 309 for( int j = 0; j < length; ++j) 310 310 { 311 311 for( int i = 0; i < 3; ++i) 312 312 { 313 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);314 tmpLength = p0.distancePoint( *tmpVec);313 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 314 tmpLength = p0.distancePoint(tmpVec); 315 315 PRINTF(0)("point[%i][%i]: %f, %f, %f with distance to plane: %f\n", j, i, tmpVec[0], tmpVec[1], tmpVec[2], tmpLength); 316 316 if( tmpLength > maxLength[0]) … … 322 322 323 323 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 324 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);325 maxLength[1] = p1.distancePoint( *tmpVec);326 minLength[1] = p1.distancePoint( *tmpVec);324 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 325 maxLength[1] = p1.distancePoint(tmpVec); 326 minLength[1] = p1.distancePoint(tmpVec); 327 327 for( int j = 0; j < length; ++j) 328 328 { 329 329 for( int i = 0; i < 3; ++i) 330 330 { 331 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);332 tmpLength = p1.distancePoint( *tmpVec);331 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 332 tmpLength = p1.distancePoint(tmpVec); 333 333 if( tmpLength > maxLength[1]) 334 334 maxLength[1] = tmpLength; … … 339 339 340 340 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 341 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);342 maxLength[2] = p2.distancePoint( *tmpVec);343 minLength[2] = p2.distancePoint( *tmpVec);341 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 342 maxLength[2] = p2.distancePoint(tmpVec); 343 minLength[2] = p2.distancePoint(tmpVec); 344 344 for( int j = 0; j < length; ++j) 345 345 { 346 346 for( int i = 0; i < 3; ++i) 347 347 { 348 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);349 tmpLength = p2.distancePoint( *tmpVec);348 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 349 tmpLength = p2.distancePoint(tmpVec); 350 350 if( tmpLength > maxLength[2]) 351 351 maxLength[2] = tmpLength; … … 362 362 { 363 363 centerOffset[i] = (fabs(maxLength[i]) - fabs(minLength[i])) / 2.0f; // min length is negatie 364 box.halfLength[i] = (maxLength[i] - minLength[i]) / 3.0f; // min length is negative364 box.halfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative 365 365 } 366 366 // FIXME: += anstatt -= ????????? verwirr -
branches/cd/src/lib/math/plane.cc
r6617 r7583 222 222 } 223 223 224 224 225 /** 225 226 * calculate the two points of minimal distance of two lines … … 324 325 * @return the distance between the plane and the point (can be negative) 325 326 */ 326 float Plane::distancePoint (const sVec3D& p) const 327 // float Plane::distancePoint (const sVec3D& p) const 328 // { 329 // Vector s(p[0], p[1], p[2]); 330 // float l = n.len(); 331 // if( l == 0.0) return 0.0; 332 // return (n.dot(s) + k) / n.len(); 333 // } 334 335 336 /** 337 * returns the distance between the plane and a point 338 * @param p: a Point 339 * @return the distance between the plane and the point (can be negative) 340 */ 341 float Plane::distancePoint (const float* p) const 327 342 { 328 343 Vector s(p[0], p[1], p[2]); -
branches/cd/src/lib/math/plane.h
r6617 r7583 51 51 Vector intersectLine (const Line& l) const; 52 52 float distancePoint (const Vector& p) const; 53 float distancePoint (const sVec3D& p) const; 53 // float distancePoint (const sVec3D& p) const; 54 float distancePoint (const float* p) const; 54 55 float locatePoint (const Vector& p) const; 55 56 };
Note: See TracChangeset
for help on using the changeset viewer.