src/gsim/se_lct_tests.cpp
// The main difference between _sector_clear() and SeTriangulator::sector_free() is that here if a "disturbance"
// is too close to the endpoints, by epsilon, it is not considered a real collision.
// Optional parameter c2 is non-null only when called from SeLct::_needs_refinement(), so that disturbances
// will be searched also when c2 is too close to a constraint.
// When precomputation is not used, this is the method called by _canpass() during channel search
The main difference between _sector_clear() and SeTriangulator::sector_free() is that here if a "disturbance"
is too close to the endpoints, by epsilon, it is not considered a real collision.
Optional parameter c2 is non-null only when called from SeLct::_needs_refinement(), so that disturbances
will be searched also when c2 is too close to a constraint.
When precomputation is not used, this is the method called by _canpass() during channel search
The main difference between _sector_clear () and SeTriangulator :: sector_free () is that here if a " disturbance " is too close to the endpoints by epsilon it is not considered a real collision . Optional parameter c2 is non - null only when called from SeLct :: _needs_refinement () so that disturbances will be searched also when c2 is too close to a constraint . When precomputation is not used this is the method called by _canpass () during channel search
bool SeLct::_sector_clear ( SeDcdtSymEdge* s, double r2, const GsVec2& c, const GsVec2& p1, const GsVec2& p2, const GsVec2* c2 )
 {
   double t, d2;
   d2 = gs_point_segment_dist2(c.x,c.y,p1.x,p1.y,p2.x,p2.y,t);
   if ( d2>=r2 ) 
    { if ( c2==0 )
       { return true;
       }
      else 
       { double c2t, c2d2;
         c2d2 = gs_point_segment_dist2(c2->x,c2->y,p1.x,p1.y,p2.x,p2.y,c2t);
         if ( c2d2>=r2 ) return true; 
         if ( s->edg()->is_constrained() )
          { if ( c2t<=0 || c2t>=1 ) return true; 
            _secblockd2 = d2; 
            _secblockse = s; 
            return false; 
          }
       }
    }
   if ( s->edg()->is_constrained() )
    { 
      if ( t<=0 || t>=1 ) return true; 
      GsVec2 p = p1*float(1.0-t)+p2*float(t);
      if ( gs_dist2(p.x,p.y,p1.x,p1.y)<=_epsilon2 ) return true; 
      if ( gs_dist2(p.x,p.y,p2.x,p2.y)<=_epsilon2 ) return true; 
      _secblockd2 = d2;
      _secblockse = s;
      _secblockpt = p;
      return false; 
    }
   if ( s->edg()->border() ) return true;
   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 ) 
    { 
      if ( !_sector_clear(s->nxt(),r2,c,p3,p2) ) return false;
    }
   if ( gs_ccw(c.x,c.y,p1.x,p1.y,p3.x,p3.y)>0 ) 
    { 
      if ( !_sector_clear(s,r2,c,p1,p3) ) return false;
    }
   return true;
 }
bool SeLct :: _sector_clear ( SeDcdtSymEdge * s , double r2 , const GsVec2 & c , const GsVec2 & p1 , const GsVec2 & p2 , const GsVec2 * c2 ) { double t , d2 ; d2 = gs_point_segment_dist2 ( c . x , c . y , p1 . x , p1 . y , p2 . x , p2 . y , t ) ; if ( d2 >= r2 ) { if ( c2 == 0 ) { return true ; } else { double c2t , c2d2 ; c2d2 = gs_point_segment_dist2 ( c2 -> x , c2 -> y , p1 . x , p1 . y , p2 . x , p2 . y , c2t ) ; if ( c2d2 >= r2 ) return true ; if ( s -> edg ( ) -> is_constrained ( ) ) { if ( c2t <= 0 || c2t >= 1 ) return true ; _secblockd2 = d2 ; _secblockse = s ; return false ; } } } if ( s -> edg ( ) -> is_constrained ( ) ) { if ( t <= 0 || t >= 1 ) return true ; GsVec2 p = p1 * float ( 1.0 - t ) + p2 * float ( t ) ; if ( gs_dist2 ( p . x , p . y , p1 . x , p1 . y ) <= _epsilon2 ) return true ; if ( gs_dist2 ( p . x , p . y , p2 . x , p2 . y ) <= _epsilon2 ) return true ; _secblockd2 = d2 ; _secblockse = s ; _secblockpt = p ; return false ; } if ( s -> edg ( ) -> border ( ) ) return true ; 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 ) { if ( ! _sector_clear ( s -> nxt ( ) , r2 , c , p3 , p2 ) ) return false ; } if ( gs_ccw ( c . x , c . y , p1 . x , p1 . y , p3 . x , p3 . y ) > 0 ) { if ( ! _sector_clear ( s , r2 , c , p1 , p3 ) ) return false ; } return true ; }
The main difference between _sector_clear() and SeTriangulator::sector_free() is that here if a "disturbance"
is too close to the endpoints, by epsilon, it is not considered a real collision.
The main difference between _sector_clear () and SeTriangulator :: sector_free () is that here if a " disturbance " is too close to the endpoints by epsilon it is not considered a real collision .
// check if s is distant enought from c: // ok enought space // check distance to the "2nd center" // ok enought space // closest point is an end point // clearance is not affected // but s may need to be subdivided // s too close to c2: requires disturbance checking // if not, test if we're trying to cross an obstacle: // closest point is an end point // closest point too close to an end point // closest point too close to an end point // pt-seg blockage found: not passable //recurse: // c-p3-p2 // c-p1-p3