Changeset 1587 for GTP/trunk/Lib
- Timestamp:
- 10/09/06 16:40:52 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp
r1586 r1587 59 59 { 60 60 // random barycentric coordinates 61 const float a = RandomValue(0,1);62 const float b = RandomValue(0,1);63 const float c = 1.0 - a - b;61 float a = RandomValue(0,1); 62 float b = RandomValue(0,1); 63 float c = RandomValue(0,1); 64 64 65 point = mItem.mVertices[0] + a * (mItem.mVertices[1] - mItem.mVertices[0]) + 66 mItem.mVertices[0] + b * (mItem.mVertices[2] - mItem.mVertices[0]) + 67 mItem.mVertices[1] + c * (mItem.mVertices[2] - mItem.mVertices[1]); 68 65 const float sum = a + b + c; 66 67 // scale so we get value between zero and one 68 if (sum) 69 { 70 a /= sum; 71 b /= sum; 72 c /= sum; 73 } 74 75 //cout << "a " << a << "b: " << b << "c: " << c << endl; 76 point = mItem.mVertices[0] * a + mItem.mVertices[1] * b + mItem.mVertices[2] * c; 69 77 normal = mItem.GetNormal(); 70 78 … … 72 80 } 73 81 82 83 int TriangleIntersectable::GetRandomVisibleSurfacePoint(Vector3 &point, 84 Vector3 &normal, 85 const Vector3 &viewpoint, 86 const int maxTries) 87 { 88 return GetRandomSurfacePoint(point, normal); 89 } 74 90 75 91 } -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
r1586 r1587 187 187 188 188 int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); 189 190 int GetRandomVisibleSurfacePoint( 191 Vector3 &point, 192 Vector3 &normal, 193 const Vector3 &viewpoint, 194 const int maxTries); 189 195 }; 190 196 -
GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp
r1586 r1587 810 810 int TransformedMeshInstance::GetRandomSurfacePoint(Vector3 &point, Vector3 &normal) 811 811 { 812 int index = mMesh->GetRandomSurfacePoint(point, normal);813 point = mWorldTransform *point;812 const int index = mMesh->GetRandomSurfacePoint(point, normal); 813 point = mWorldTransform * point; 814 814 normal = TransformNormal(mWorldTransform, normal); 815 815 return index; -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1576 r1587 62 62 { 63 63 Vector3 origin, direction; 64 const int i = (int)RandomValue(0, (Real) ((int)mPreprocessor.mObjects.size() - 1));64 const int i = (int)RandomValue(0, (Real)mPreprocessor.mObjects.size() - 0.5f); 65 65 Intersectable *object = mPreprocessor.mObjects[i]; 66 66
Note: See TracChangeset
for help on using the changeset viewer.