src/gsim/se_lct_tests.cpp
// s is the edge being tested, x1,y1-x2,y2 its coordinates
// v is the vertex being tested, which will be x1,y1 or x2,y2
s is the edge being tested, x1,y1-x2,y2 its coordinates
v is the vertex being tested, which will be x1,y1 or x2,y2
s is the edge being tested x1 y1 - x2 y2 its coordinates v is the vertex being tested which will be x1 y1 or x2 y2
void SeLct::_collect_entrance_disturbances (
            int i, int fst, bool top, SeBase* s, SeVertex* v, 
            double x1, double y1, double x2, double y2, const Capsule& c )
 {
   double x3, y3;
   if ( s->vtx()==v ) { x3=x1; y3=y1; } else { x3=x2; y3=y2; }
   GsArray<GsPnt2>& fp = _ent[i].fp;
   if ( !_mesh->marked(v) && 
        gs_ccw(c.bx,c.by,fp[fst].x,fp[fst].y,x3,y3)>0 &&
        gs_ccw(x3,y3,fp.top().x,fp.top().y,c.ax,c.ay)>0 &&
        gs_point_segment_dist2(x3,y3,c.ax,c.ay,c.bx,c.by)<c.r2 )
    {
      if ( !top )
       { if ( gs_ccw(c.bx,c.by,x3,y3,fp.top().x,fp.top().y)>0 ) 
          _fp_add_point ( fp, _ent[i].fv, fst, v, x3, y3 ); 
       }
      else
       { if ( gs_ccw(x3,y3,c.ax,c.ay,fp[fst].x,fp[fst].y)>0 ) 
          _fp_add_point ( fp, _ent[i].fv, fst, v, x3, y3 ); 
       }
    }
   _mesh->mark(v);
   if ( i==3 ) _elembuffer.push().set(v,0);
   if ( _man->is_constrained(s->edg()) ) return;
   SeBase* sn = s->ret();
   SeBase* sp = sn->nxt();
   _man->get_vertex_coordinates ( sp->vtx(), x3, y3 );
   if ( !_mesh->marked(sn->edg()) )
    { _mesh->mark(sn->edg());
      if ( i==3 ) _elembuffer.push().set(0,sn);
      if ( gs_segment_segment_dist2(x1,y1,x3,y3,c.ax,c.ay,c.bx,c.by)<c.r2 )
        _collect_entrance_disturbances ( i, fst, top, sn, sp->vtx(), x1, y1, x3, y3, c );
    }
   if ( !_mesh->marked(sp->edg()) )
    { _mesh->mark(sp->edg());
      if ( i==3 ) _elembuffer.push().set(0,sp);
      if ( gs_segment_segment_dist2(x3,y3,x2,y2,c.ax,c.ay,c.bx,c.by)<c.r2 )
        _collect_entrance_disturbances ( i, fst, top, sp, sp->vtx(), x3, y3, x2, y2, c );
    }
 }
void SeLct :: _collect_entrance_disturbances ( int i , int fst , bool top , SeBase * s , SeVertex * v , double x1 , double y1 , double x2 , double y2 , const Capsule & c ) { double x3 , y3 ; if ( s -> vtx ( ) == v ) { x3 = x1 ; y3 = y1 ; } else { x3 = x2 ; y3 = y2 ; } GsArray < GsPnt2 > & fp = _ent [ i ] . fp ; if ( ! _mesh -> marked ( v ) && gs_ccw ( c . bx , c . by , fp [ fst ] . x , fp [ fst ] . y , x3 , y3 ) > 0 && gs_ccw ( x3 , y3 , fp . top ( ) . x , fp . top ( ) . y , c . ax , c . ay ) > 0 && gs_point_segment_dist2 ( x3 , y3 , c . ax , c . ay , c . bx , c . by ) < c . r2 ) { if ( ! top ) { if ( gs_ccw ( c . bx , c . by , x3 , y3 , fp . top ( ) . x , fp . top ( ) . y ) > 0 ) _fp_add_point ( fp , _ent [ i ] . fv , fst , v , x3 , y3 ) ; } else { if ( gs_ccw ( x3 , y3 , c . ax , c . ay , fp [ fst ] . x , fp [ fst ] . y ) > 0 ) _fp_add_point ( fp , _ent [ i ] . fv , fst , v , x3 , y3 ) ; } } _mesh -> mark ( v ) ; if ( i == 3 ) _elembuffer . push ( ) . set ( v , 0 ) ; if ( _man -> is_constrained ( s -> edg ( ) ) ) return ; SeBase * sn = s -> ret ( ) ; SeBase * sp = sn -> nxt ( ) ; _man -> get_vertex_coordinates ( sp -> vtx ( ) , x3 , y3 ) ; if ( ! _mesh -> marked ( sn -> edg ( ) ) ) { _mesh -> mark ( sn -> edg ( ) ) ; if ( i == 3 ) _elembuffer . push ( ) . set ( 0 , sn ) ; if ( gs_segment_segment_dist2 ( x1 , y1 , x3 , y3 , c . ax , c . ay , c . bx , c . by ) < c . r2 ) _collect_entrance_disturbances ( i , fst , top , sn , sp -> vtx ( ) , x1 , y1 , x3 , y3 , c ) ; } if ( ! _mesh -> marked ( sp -> edg ( ) ) ) { _mesh -> mark ( sp -> edg ( ) ) ; if ( i == 3 ) _elembuffer . push ( ) . set ( 0 , sp ) ; if ( gs_segment_segment_dist2 ( x3 , y3 , x2 , y2 , c . ax , c . ay , c . bx , c . by ) < c . r2 ) _collect_entrance_disturbances ( i , fst , top , sp , sp -> vtx ( ) , x3 , y3 , x2 , y2 , c ) ; } }
s is the edge being tested, x1,y1-x2,y2 its coordinates
v is the vertex being tested, which will be x1,y1 or x2,y2
s is the edge being tested x1 y1 - x2 y2 its coordinates v is the vertex being tested which will be x1 y1 or x2 y2
// get point to test: // test if point is a valid disturbance: // bottom entrance test // insert point // top entrance test // insert point // mark point as already tested: // if current edge is constrained, do not further recurse: // recurse if needed: