public QuadEdge locateFromEdge(Vertex v,QuadEdge startEdge){
  int iter=0;
  int maxIter=quadEdges.size();
  QuadEdge e=startEdge;
  while (true) {
    iter++;
    if (iter > maxIter) {
      throw new LocateFailureException(e.toLineSegment());
    }
    if ((v.equals(e.orig())) || (v.equals(e.dest()))) {
      break;
    }
 else     if (v.rightOf(e)) {
      e=e.sym();
    }
 else     if (!v.rightOf(e.oNext())) {
      e=e.oNext();
    }
 else     if (!v.rightOf(e.dPrev())) {
      e=e.dPrev();
    }
 else {
      break;
    }
  }
  return e;
}

public QuadEdge locateFromEdge ( Vertex v , QuadEdge startEdge ) { int iter = 0 ; int maxIter = quadEdges . size ( ) ; QuadEdge e = startEdge ; while ( true ) { iter ++ ; if ( iter > maxIter ) { throw new LocateFailureException ( e . toLineSegment ( ) ) ; } if ( ( v . equals ( e . orig ( ) ) ) || ( v . equals ( e . dest ( ) ) ) ) { break ; } else if ( v . rightOf ( e ) ) { e = e . sym ( ) ; } else if ( ! v . rightOf ( e . oNext ( ) ) ) { e = e . oNext ( ) ; } else if ( ! v . rightOf ( e . dPrev ( ) ) ) { e = e . dPrev ( ) ; } else { break ; } } return e ; }
locates an edge of a triangle which contains a location specified by a vertex v . the edge returned has the property that either v is on e , or e is an edge of a triangle containing v . the search starts from startedge amd proceeds on the general direction of v . < p > this locate algorithm relies on the subdivision being delaunay . for non - delaunay subdivisions , this may loop for ever .
