src/gsim/se_triangulator_search.cpp
/* - This is the A* algorithm that takes O(nf), f is the faces in the "expansion frontier". */
This is the A* algorithm that takes O(nf), f is the faces in the "expansion frontier".
This is the A * algorithm that takes O ( nf ) f is the faces in the " expansion frontier " .
bool SeTriangulator::search_channel ( double x1, double y1, double x2, double y2, const SeFace* iniface )
 {
   LocateResult res;
   SeBase *s;
   GS_TRACE1 ( "Starting Search Path..." );
   if ( !_ptree ) _ptree = new PathTree;
   _channel.size(0);
   _xi=x1; _yi=y1; _xg=x2; _yg=y2;
   if ( !iniface ) return _path_found=false;
   res=locate_point ( iniface, x1, y1, s );
   if ( res==NotFound )
    { GS_TRACE1 ( "Could not locate first point!" );
      return _path_found=false;
    }
   if ( _man->in_triangle(s->vtx(),s->nxt()->vtx(),s->pri()->vtx(),x2,y2) )
    { GS_TRACE1 ( "Both points are in the same triangle..." );
      GS_TRACE1 ( "Trivial path returned." );
      return _path_found=true; 
    }
   GS_TRACE1 ( "Initializing A* search..." );
   _mesh->begin_marking ();
   _ptree_init ( res, s );
   GS_TRACE1 ( "Expanding leafs..." );
   int found = ExpansionNotFinished;
   while ( found==ExpansionNotFinished )
    found = _expand_lowest_cost_leaf();
   _mesh->end_marking ();
   if ( found==ExpansionBlocked )
    { GS_TRACE1 ( "Points are not connectable!" );
      return _path_found=false;
    }
   int n = found; 
   s = _ptree->nodes[n].ex->sym();
   do { _channel.push() = _ptree->nodes[n].ex;
        n = _ptree->nodes[n].parent; 
      } while ( n!=-1 );
   _channel.revert();
   GS_TRACE1 ( "Path crosses "<<_channel.size()<<" edges." );
   return _path_found=true;
 }
bool SeTriangulator :: search_channel ( double x1 , double y1 , double x2 , double y2 , const SeFace * iniface ) { LocateResult res ; SeBase * s ; GS_TRACE1 ( " " ) ; if ( ! _ptree ) _ptree = new PathTree ; _channel . size ( 0 ) ; _xi = x1 ; _yi = y1 ; _xg = x2 ; _yg = y2 ; if ( ! iniface ) return _path_found = false ; res = locate_point ( iniface , x1 , y1 , s ) ; if ( res == NotFound ) { GS_TRACE1 ( " " ) ; return _path_found = false ; } if ( _man -> in_triangle ( s -> vtx ( ) , s -> nxt ( ) -> vtx ( ) , s -> pri ( ) -> vtx ( ) , x2 , y2 ) ) { GS_TRACE1 ( " " ) ; GS_TRACE1 ( " " ) ; return _path_found = true ; } GS_TRACE1 ( " " ) ; _mesh -> begin_marking ( ) ; _ptree_init ( res , s ) ; GS_TRACE1 ( " " ) ; int found = ExpansionNotFinished ; while ( found == ExpansionNotFinished ) found = _expand_lowest_cost_leaf ( ) ; _mesh -> end_marking ( ) ; if ( found == ExpansionBlocked ) { GS_TRACE1 ( " " ) ; return _path_found = false ; } int n = found ; s = _ptree -> nodes [ n ] . ex -> sym ( ) ; do { _channel . push ( ) = _ptree -> nodes [ n ] . ex ; n = _ptree -> nodes [ n ] . parent ; } while ( n != -1 ) ; _channel . revert ( ) ; GS_TRACE1 ( " " << _channel . size ( ) << " " ) ; return _path_found = true ; }
This is the A* algorithm that takes O(nf), f is the faces in the "expansion frontier".
This is the A * algorithm that takes O ( nf ) f is the faces in the " expansion frontier " .
// Even if p1 is on an edge, locate_point will return in s a face that  // can be considered to contain p1 (p1 would be invalid if in a vertex) // Check if we are to solve trivial or local paths, testing if both points are in the same triangle: // this is it // the starting leaf