- Timestamp:
- Dec 5, 2005, 12:48:07 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
r5927 r5929 169 169 170 170 /* calculate the cetroid of the hull triangles */ 171 centroid[i] = (p + q + r) * 1/3;171 centroid[i] = (p + q + r) / 3.0f; 172 172 /* now calculate the centroid of the entire convex hull, weighted average of triangle centroids */ 173 173 center += centroid[i] * facelet[i]; … … 193 193 r = *tmpVec; 194 194 195 covariance[j][k] = facelet[i] / (12.0f * face)* (9.0f * centroid[i][j] * centroid[i][k] + p[j] * p[k] +196 q[j] * q[k] + r[j] * r[k]) - center[j] * center[k];195 covariance[j][k] = facelet[i] * (9.0f * centroid[i][j] * centroid[i][k] + p[j] * p[k] + 196 q[j] * q[k] + r[j] * r[k]); 197 197 } 198 covariance[j][k] = covariance[j][k] / (12.0f * face) - center[j] * center[k]; 198 199 } 199 200 } … … 248 249 for(int k = 0; k < 3; ++k) 249 250 { 250 PRINT(3)("%11. 2f\t", covariance[j][k]);251 PRINT(3)("%11.4f\t", covariance[j][k]); 251 252 } 252 253 PRINT(3)("\n"); 253 254 } 254 PRINTF(3)("\nWeighteed OBB Center:\n\t\t%11. 2f\t %11.2f\t %11.2f\n", center.x, center.y, center.z);255 PRINTF(3)("\nArithmetical OBB Center:\n\t\t%11. 2f\t %11.2f\t %11.2f\n", box.arithCenter.x, box.arithCenter.y, box.arithCenter.z);255 PRINTF(3)("\nWeighteed OBB Center:\n\t\t%11.4f\t %11.4f\t %11.4f\n", center.x, center.y, center.z); 256 PRINTF(3)("\nArithmetical OBB Center:\n\t\t%11.4f\t %11.4f\t %11.4f\n", box.arithCenter.x, box.arithCenter.y, box.arithCenter.z); 256 257 257 258 /* write back the covariance matrix data to the object oriented bouning box */
Note: See TracChangeset
for help on using the changeset viewer.