Changeset 4544 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
- Timestamp:
- Jun 7, 2005, 10:40:18 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4543 r4544 19 19 #include "list.h" 20 20 #include "obb.h" 21 #include "fast_math.h" 22 #include "vector.h" 21 23 22 24 #include <math.h> … … 51 53 \param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle 52 54 */ 53 void OBBTreeNode::spawnBVTree(const int depth, constsVec3D *verticesList, const int length)55 void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length) 54 56 { 55 57 float facelet[length]; //!< surface area of the i'th triangle of the convex hull … … 57 59 float centroid[length]; //!< centroid of the i'th convex hull 58 60 OBB* obb = new OBB(); //!< the new obb to add 61 Vector p, q, r; //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d 62 Vector t1, t2; 59 63 60 /* fist compute all the convex hull face lets */61 for(int i = 0; i < length; ++i)64 /* fist compute all the convex hull face/facelets */ 65 for(int i = 0; i < length; i+=3) 62 66 { 63 facelet[i] = 0.5f * fabs(5.0); 67 p = *(verticesList + i); 68 q = *(verticesList + i + 1); 69 r = *(verticesList + i + 2); 70 71 t1 = p - q; t2 = p - r; 72 73 /* finding the facelet surface via cross-product */ 74 facelet[i] = 0.5f * fabs( t1.cross(t2).len() ); 75 76 /* update the entire convex hull surface */ 77 face += facelet[i]; 64 78 } 79 80 65 81 } 66 82
Note: See TracChangeset
for help on using the changeset viewer.