Ignore:
Timestamp:
02/14/06 17:13:42 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h

    r504 r639  
    4040  } 
    4141 
    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; 
    4545 
    4646  /** Finds intersection of line segment between points a and b with plane. 
     
    5353                                                   const Vector3 &b, 
    5454                                                   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; 
    7456   
    7557  /** Finds value of intersection parameter t on line segment from a to b. 
    76       @returns -1 if coplanar, else parameter t 
     58      @returns 0 if coplanar, else parameter t 
    7759  */ 
    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; 
    8961 
    9062  friend bool 
Note: See TracChangeset for help on using the changeset viewer.