src/gsim/se_lct_tests.cpp
// This is the function called for computing the maximum clearance during precomputation.
// It is called by SeLct::compute_clearance ()
This is the function called for computing the maximum clearance during precomputation.
This is the function called for computing the maximum clearance during precomputation .
double SeLct::_sector_clearance ( SeDcdtSymEdge* s, double maxr2, const GsVec2& c, const GsVec2& p1, const GsVec2& p2 )
 {
   double t, d2, e2;
   d2 = gs_point_segment_dist2(c.x,c.y,p1.x,p1.y,p2.x,p2.y,t);
   if ( d2+_epsilon>maxr2 ) return maxr2; 
   if ( s->edg()->is_constrained() )
    { return d2; } 
   d2 = -1;
   s=s->sym()->nxt();
   const GsVec2& p3 = s->nvtx()->p;
   if ( gs_ccw(c.x,c.y,p3.x,p3.y,p2.x,p2.y)>0 ) 
    { 
      d2 = _sector_clearance(s->nxt(),maxr2,c,p3,p2);
    }
   if ( gs_ccw(c.x,c.y,p1.x,p1.y,p3.x,p3.y)>0 ) 
    { 
      e2 = _sector_clearance(s,maxr2,c,p1,p3);
      d2 = d2<0? e2 : GS_MIN(d2,e2);
    }
   return d2;
 }
double SeLct :: _sector_clearance ( SeDcdtSymEdge * s , double maxr2 , const GsVec2 & c , const GsVec2 & p1 , const GsVec2 & p2 ) { double t , d2 , e2 ; d2 = gs_point_segment_dist2 ( c . x , c . y , p1 . x , p1 . y , p2 . x , p2 . y , t ) ; if ( d2 + _epsilon > maxr2 ) return maxr2 ; if ( s -> edg ( ) -> is_constrained ( ) ) { return d2 ; } d2 = -1 ; s = s -> sym ( ) -> nxt ( ) ; const GsVec2 & p3 = s -> nvtx ( ) -> p ; if ( gs_ccw ( c . x , c . y , p3 . x , p3 . y , p2 . x , p2 . y ) > 0 ) { d2 = _sector_clearance ( s -> nxt ( ) , maxr2 , c , p3 , p2 ) ; } if ( gs_ccw ( c . x , c . y , p1 . x , p1 . y , p3 . x , p3 . y ) > 0 ) { e2 = _sector_clearance ( s , maxr2 , c , p1 , p3 ) ; d2 = d2 < 0 ? e2 : GS_MIN ( d2 , e2 ) ; } return d2 ; }
This is the function called for computing the maximum clearance during precomputation.
This is the function called for computing the maximum clearance during precomputation .
// check if s is distant enough from c: // ok enought space, return maximum possible clearance // Note: the epsilon addition has not been tested if it is indeed needed, but it is // used here to make sure cases of exact maxr2 are always detected (note that maxr2=min{edg1len,edg2len}) // if not distant enough, test if we're trying to cross an obstacle: // pt-seg blockage found, so maximum clearance value found //recurse: // c-p3-p2 // c-p1-p3