Changeset 4609 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 12, 2005, 11:37:57 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree.cc
r4590 r4609 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, 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}};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}}; 101 101 102 102 for(int i = 0; i < length; ++i) -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4589 r4609 190 190 Jacobi(C, D, V); /* do the jacobi decomposition */ 191 191 192 printf(" we got a result! YES: \n");192 printf("\nwe got a result! YES: \n"); 193 193 194 194 for(int j = 1; j < 4; ++j) … … 207 207 box->axis = axis; 208 208 209 printf(" eigenvector: %f, %f, %f\n", box->axis[0]->x, box->axis[0]->y, box->axis[0]->z);209 printf("\neigenvector: %f, %f, %f\n", box->axis[0]->x, box->axis[0]->y, box->axis[0]->z); 210 210 printf("eigenvector: %f, %f, %f\n", box->axis[1]->x, box->axis[1]->y, box->axis[1]->z); 211 211 printf("eigenvector: %f, %f, %f\n", box->axis[2]->x, box->axis[2]->y, box->axis[2]->z); … … 216 216 float* halfLength = new float[3]; //!< half length of the axis 217 217 float tmpLength; //!< tmp save point for the length 218 219 220 Plane p0(*box->axis[0], *box->center); 221 Plane p1(*box->axis[1], *box->center); 222 Plane p2(*box->axis[2], *box->center); 218 Plane p0(*box->axis[0], *box->center); //!< the axis planes 219 Plane p1(*box->axis[1], *box->center); 220 Plane p2(*box->axis[2], *box->center); 223 221 224 222 halfLength[0] = -1.0f; … … 249 247 250 248 251 printf(" we got length: \n");249 printf("\nwe got length: \n"); 252 250 for(int i = 0; i < 3; ++i) 253 251 printf("length[%i] = %f\n", i, box->halfLength[i]); … … 255 253 256 254 255 256 /** 257 \brief this separates an ob-box in the middle 258 \param box: the box to separate 259 260 this will separate the box into to smaller boxes. the separation is done along the middle of the longest axis 261 */ 257 262 void OBBTreeNode::forkBox(OBB* box) 258 263 { 259 264 /* get the longest axis of the box */ 260 float aLength = -1.0f; 261 int axisNr = 0; 265 float aLength = -1.0f; //!< the length of the longest axis 266 int axisIndex = 0; //!< this is the nr of the longest axis 267 262 268 for(int i = 0; i < 3; ++i) 263 { 264 if( aLength < box->axis[i]->len()) 265 { 266 aLength = box->axis[i]->len(); 267 axisNr = i; 268 } 269 } 269 { 270 if( aLength < box->halfLength[i]) 271 { 272 aLength = box->halfLength[i]; 273 axisIndex = i; 274 } 275 } 276 277 printf("\nlongest axis is: nr %i with a half-length of: %f\n", axisIndex, aLength); 278 270 279 271 280 /* get the closest vertex near the center */ 281 float dist = 0.0f; //!< the smallest distance to each vertex 282 float tmpDist; //!< temporary distance 283 int vertexIndex; 284 Plane separationPlane(*box->axis[axisIndex], *box->center); //!< the separation plane definition 285 286 for(int i = 0; i < box->numOfVertices; ++i) 287 { 288 tmpDist = fabs(separationPlane.distancePoint(vertices[i])); 289 if( tmpDist > dist) 290 dist = tmpDist; 291 } 292 293 294 printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist); 295 272 296 273 297 } -
orxonox/trunk/src/lib/math/vector.h
r4585 r4609 31 31 /** \param v The vector to add \returns the addition between two vectors (this + v) */ 32 32 inline Vector operator+ (const Vector& v) const { return Vector(x + v.x, y + v.y, z + v.z); }; 33 /** \param v The vector to add \returns the addition between two vectors (this + v) */ 34 inline Vector operator+ (const sVec3D& v) const { return Vector(x + v[0], y + v[1], z + v[2]); }; 33 35 /** \param v The vector to add \returns the addition between two vectors (this += v) */ 34 36 inline const Vector& operator+= (const Vector& v) { this->x += v.x; this->y += v.y; this->z += v.z; return *this; }; 35 37 /** \param v The vector to substract \returns the substraction between two vectors (this - v) */ 38 inline const Vector& operator+= (const sVec3D& v) { this->x += v[0]; this->y += v[1]; this->z += v[2]; return *this; }; 39 /** \param v The vector to substract \returns the substraction between two vectors (this - v) */ 36 40 inline Vector operator- (const Vector& v) const { return Vector(x - v.x, y - v.y, z - v.z); } 41 /** \param v The vector to substract \returns the substraction between two vectors (this - v) */ 42 inline Vector operator- (const sVec3D& v) const { return Vector(x - v[0], y - v[1], z - v[2]); } 37 43 /** \param v The vector to substract \returns the substraction between two vectors (this -= v) */ 38 44 inline const Vector& operator-= (const Vector& v) { this->x -= v.x; this->y -= v.y; this->z -= v.z; return *this; }; 45 /** \param v The vector to substract \returns the substraction between two vectors (this -= v) */ 46 inline const Vector& operator-= (const sVec3D& v) { this->x -= v[0]; this->y -= v[1]; this->z -= v[2]; return *this; }; 39 47 /** \param v the second vector \returns The dotProduct between two vector (this (dot) v) */ 40 48 inline float operator* (const Vector& v) const { return x * v.x + y * v.y + z * v.z; };
Note: See TracChangeset
for help on using the changeset viewer.