Changeset 639 for GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h
- Timestamp:
- 02/14/06 17:13:42 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h
r504 r639 40 40 } 41 41 42 int Side(const Vector3 &v, const float threshold = 1e-6) const {43 return signum(Distance(v), threshold);44 }42 /** Returns 1 if v is on front side, -1 if on back side, 0 if on plane. 43 */ 44 int Side(const Vector3 &v, const float threshold = 1e-6) const; 45 45 46 46 /** Finds intersection of line segment between points a and b with plane. … … 53 53 const Vector3 &b, 54 54 float *t = NULL, 55 bool *coplanar = NULL) const 56 { 57 const Vector3 v = b - a; // line from A to B 58 float dv = DotProd(v, mNormal); 59 60 if (signum(dv) == 0) 61 { 62 if (coplanar) (*coplanar) = true; 63 if (t) (*t) = 0; 64 return a; 65 } 66 67 if (coplanar) (*coplanar) = false; 68 float u = - Distance(a) / dv; // TODO: could be done more efficiently 69 70 if (t) (*t) = u; 71 72 return a + u * v; 73 } 55 bool *coplanar = NULL) const; 74 56 75 57 /** Finds value of intersection parameter t on line segment from a to b. 76 @returns -1if coplanar, else parameter t58 @returns 0 if coplanar, else parameter t 77 59 */ 78 float FindT(const Vector3 &a, const Vector3 &b) const 79 { 80 const Vector3 v = b - a; // line from A to B 81 const float dv = DotProd(v, mNormal); 82 83 // does not intersect or coincident 84 if (signum(dv) == 0) 85 return 0; 86 87 return - Distance(a) / dv; // TODO: could be done more efficiently 88 } 60 float FindT(const Vector3 &a, const Vector3 &b) const; 89 61 90 62 friend bool
Note: See TracChangeset
for help on using the changeset viewer.