Changeset 7711 in orxonox.OLD for trunk/src/lib/math
- Timestamp:
- May 18, 2006, 11:44:21 PM (19 years ago)
- Location:
- trunk/src/lib/math
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/math/matrix.cc
r5696 r7711 244 244 245 245 eigVc3 = eigVc1.cross(eigVc2); 246 247 eigVc2 = eigVc3.cross(eigVc1); 246 248 } 247 249 else if (eigenValuesCount == 1) … … 254 256 eigVc2.normalize(); 255 257 eigVc3.normalize(); 258 259 if (!(eigVc1.cross(eigVc3) == eigVc2)) 260 { 261 eigVc3.cross(eigVc1); 262 // eigVc2.debug(); 263 } 264 /* printf("ok\n")*/; 256 265 } 257 266 -
trunk/src/lib/math/plane.cc
r6617 r7711 222 222 } 223 223 224 224 225 /** 225 226 * calculate the two points of minimal distance of two lines … … 267 268 { 268 269 n = (a-b).cross(c-b); 269 k = -(n.x*b.x+n.y*b.y+n.z*b.z);270 k = n.dot(a) / n.len(); 270 271 } 271 272 … … 278 279 { 279 280 n = norm; 280 k = -(n.x*p.x+n.y*p.y+n.z*p.z);281 k = n.dot(p) / n.len(); 281 282 } 282 283 … … 291 292 Vector p(g[0], g[1], g[2]); 292 293 n = norm; 293 k = -(n.x*p.x+n.y*p.y+n.z*p.z);294 k = n.dot(p) / n.len(); 294 295 } 295 296 … … 315 316 float l = n.len(); 316 317 if( l == 0.0) return 0.0; 317 return (n.dot(p) + k) / n.len();318 return (n.dot(p) / n.len() - k); 318 319 } 319 320 … … 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]); 344 329 345 float l = n.len(); 330 346 if( l == 0.0) return 0.0; 331 return (n.dot(s) + k) / n.len();347 return (n.dot(s) / n.len() - k); 332 348 } 333 349 -
trunk/src/lib/math/plane.h
r6617 r7711 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 }; -
trunk/src/lib/math/vector.h
r7191 r7711 85 85 /** copy constructor* @param v the sVec3D to assign to this vector. @returns the vector v */ 86 86 inline const Vector& operator= (const sVec3D& v) { this->x = v[0]; this->y = v[1]; this->z = v[2]; } 87 inline const Vector& operator= (const float* v) { this->x = v[0]; this->y = v[1]; this->z = v[2]; } 87 88 /** @param v: the other vector \return the dot product of the vectors */ 88 89 float dot (const Vector& v) const { return x*v.x+y*v.y+z*v.z; };
Note: See TracChangeset
for help on using the changeset viewer.