Changeset 2755 for GTP/trunk/App/Demos/Vis/CHC_revisited/Plane3.cpp
- Timestamp:
- 06/12/08 01:09:23 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Plane3.cpp
r2751 r2755 8 8 Plane3::Plane3(const Vector3 &a, const Vector3 &b, const Vector3 &c) 9 9 { 10 Vector3 v1 =a-b, v2=c-b;11 mNormal = Normalize(CrossProd(v2, v1));10 Vector3 v1 = a - b, v2 = c - b; 11 mNormal = Normalize(CrossProd(v2, v1)); 12 12 mD = -DotProd(b, mNormal); 13 } 14 15 16 Plane3::Plane3(Vector3 &normal, float dist): 17 mNormal(normal), mD(dist) 18 { 13 19 } 14 20 … … 28 34 Vector3 sx(a.mNormal.x, b.mNormal.x, c.mNormal.x), 29 35 sy(a.mNormal.y, b.mNormal.y, c.mNormal.y), 30 31 36 sz(a.mNormal.z, b.mNormal.z, c.mNormal.z), 37 sd(a.mD, b.mD, c.mD); 32 38 33 39 Matrix4x4 md(a.mNormal, b.mNormal, c.mNormal), mx, my, mz; 34 40 35 mx.SetColumns(sd, sy, sz); 36 my.SetColumns(sx, sd, sz); 37 mz.SetColumns(sx, sy, sd); 38 39 const float det = md.Det3x3(); 41 mx.SetColumns(sd, sy, sz); 42 my.SetColumns(sx, sd, sz); 43 mz.SetColumns(sx, sy, sd); 40 44 41 if (fabs(det) < TRASH) 42 return false; 45 const float det = md.Det3x3(); 43 46 44 result.SetValue(mx.Det3x3()/det, 45 my.Det3x3()/det, 46 mz.Det3x3()/det); 47 48 return true; 47 if (fabs(det) < TRASH) 48 return false; 49 50 result.SetValue(mx.Det3x3()/det, 51 my.Det3x3()/det, 52 mz.Det3x3()/det); 53 54 return true; 49 55 } 50 56 51 57 52 53 54 55 56 57 58 59 58 bool PlaneIntersection(const Plane3 &p1, const Plane3 &p2) 59 { 60 return 61 p1.mNormal.x != p2.mNormal.x || 62 p1.mNormal.y != p2.mNormal.y || 63 p1.mNormal.z != p2.mNormal.z || 64 p1.mD == p2.mD; 65 } 60 66 61 67
Note: See TracChangeset
for help on using the changeset viewer.