Changeset 535 for trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp
- Timestamp:
- 01/13/06 17:39:43 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp
r534 r535 28 28 mPlanes.push_back(Plane3(-CrossProd(directions[3], directions[0]), center)); 29 29 30 31 30 // now make sure all planes contain the spatial box 32 31 int i, j; 33 for (i=0; i < mPlanes.size(); i++) { 34 for (j=0; j < 8; j++) { 35 float dist = mPlanes[i].Distance(box.GetVertex(j)); 36 if (dist > 0) 37 mPlanes[i].mD -= dist; 38 } 32 for (i=0; i < mPlanes.size(); i++) 33 { 34 float maxDist = 0; 35 36 for (j=0; j < 8; j++) 37 { 38 float dist = mPlanes[i].Distance(box.GetVertex(j)); 39 40 if (dist > maxDist) 41 maxDist = dist; 42 } 43 44 mPlanes[i].mD -= maxDist; 39 45 } 40 46 … … 85 91 } 86 92 93 87 94 Vector3 Beam::GetMainDirection() const 88 95 { 89 Vector3 directions[4]; 90 91 directions[0] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Min().y); 92 directions[1] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Min().y); 93 directions[2] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Max().y); 94 directions[3] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Max().y); 95 96 const Vector3 mainDir = directions[0] + directions[1] + directions[2] + directions[3]; 97 return Normalize(mainDir); 96 const Vector3 dCenter = mDirBox.Center(); 97 return VssRay::GetDirection(dCenter.x, dCenter.y); 98 98 } 99 99
Note: See TracChangeset
for help on using the changeset viewer.