src/gsim/se_triangulator_manager.cpp
// a more efficient implementation would use marking instead of the many CCW tests
a more efficient implementation would use marking instead of the many CCW tests
a more efficient implementation would use marking instead of the many CCW tests
bool SeTriangulatorManager::sector_vfree ( SeBase* s, double r2, double cx, double cy,
                            double x1, double y1, double x2, double y2, SeBase*& sv )
 {
   double t, d2, x3, y3;
   d2 = gs_point_segment_dist2(cx,cy,x1,y1,x2,y2,t);
   if ( d2>=r2 ) return true; 
   if ( gs_next2(cx,cy,x1,y1,r2) ) {sv=s; return false;}
   if ( gs_next2(cx,cy,x2,y2,r2) ) {sv=s->nxt(); return false; }
   s=s->sym()->nxt();
   if ( s->nxt()->nxn()!=s ) return true; 
   get_vertex_coordinates ( s->nvtx(), x3, y3 );
   if ( gs_ccw(cx,cy,x3,y3,x2,y2)>0 ) 
    { 
      if ( !sector_vfree(s->nxt(),r2,cx,cy,x3,y3,x2,y2,sv) ) return false;
    }
   if ( gs_ccw(cx,cy,x1,y1,x3,y3)>0 ) 
    { 
      if ( !sector_vfree(s,r2,cx,cy,x1,y1,x3,y3,sv) ) return false;
    }
   return true;
 }
bool SeTriangulatorManager :: sector_vfree ( SeBase * s , double r2 , double cx , double cy , double x1 , double y1 , double x2 , double y2 , SeBase * & sv ) { double t , d2 , x3 , y3 ; d2 = gs_point_segment_dist2 ( cx , cy , x1 , y1 , x2 , y2 , t ) ; if ( d2 >= r2 ) return true ; if ( gs_next2 ( cx , cy , x1 , y1 , r2 ) ) { sv = s ; return false ; } if ( gs_next2 ( cx , cy , x2 , y2 , r2 ) ) { sv = s -> nxt ( ) ; return false ; } s = s -> sym ( ) -> nxt ( ) ; if ( s -> nxt ( ) -> nxn ( ) != s ) return true ; get_vertex_coordinates ( s -> nvtx ( ) , x3 , y3 ) ; if ( gs_ccw ( cx , cy , x3 , y3 , x2 , y2 ) > 0 ) { if ( ! sector_vfree ( s -> nxt ( ) , r2 , cx , cy , x3 , y3 , x2 , y2 , sv ) ) return false ; } if ( gs_ccw ( cx , cy , x1 , y1 , x3 , y3 ) > 0 ) { if ( ! sector_vfree ( s , r2 , cx , cy , x1 , y1 , x3 , y3 , sv ) ) return false ; } return true ; }
a more efficient implementation would use marking instead of the many CCW tests
a more efficient implementation would use marking instead of the many CCW tests
// check if s is distant enought from c: // ok enought space // test if we're too close to a vertex: // recurse if border not reached: // attention: this border test assumes non-triangular backface // c-p3-p2 // c-p1-p3