Changeset 545 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
- Timestamp:
- 01/17/06 00:28:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r544 r545 1167 1167 } 1168 1168 1169 1169 1170 Plane3 BspTree::SelectPlane(BspLeaf *leaf, BspTraversalData &data) 1170 1171 { … … 1553 1554 } 1554 1555 1555 bool useRand; ;1556 bool useRand; 1556 1557 int limit; 1557 1558 … … 2559 2560 PolygonContainer::const_iterator pit, pit_end = mPolys.end(); 2560 2561 2562 // note: can take arbitrary point, e.g., the origin. However, 2563 // center of mass prevents precision errors 2564 const Vector3 center = CenterOfMass(); 2565 2561 2566 for (pit = mPolys.begin(); pit != pit_end; ++ pit) 2562 2567 { 2563 2568 Polygon3 *poly = *pit; 2564 const Vector3 v = poly->mVertices[0];2569 const Vector3 v0 = poly->mVertices[0] - center; 2565 2570 2566 2571 for (int i = 1; i < (int)poly->mVertices.size() - 1; ++ i) 2567 2572 { 2568 volume += f * (DotProd(v, 2569 CrossProd(poly->mVertices[i], poly->mVertices[i + 1]))); 2570 } 2571 } 2572 2573 Debug << "volume: " << volume << endl; 2573 const Vector3 v1 = poly->mVertices[i] - center; 2574 const Vector3 v2 = poly->mVertices[i + 1] - center; 2575 2576 volume += f * (DotProd(v0, CrossProd(v1, v2))); 2577 } 2578 } 2579 2574 2580 return volume; 2575 2581 } 2576 2582 2577 2583 2578 Vector3 BspNodeGeometry::C omputeMassCenter() const2584 Vector3 BspNodeGeometry::CenterOfMass() const 2579 2585 { 2580 2586 int n = 0;
Note: See TracChangeset
for help on using the changeset viewer.