16 : tri(atri), funnel(atri.size())
21 source(nullptr), d(), epsilon(NAN), validPlacements(nullptr)
27 QLineF d,
double epsilon,
38 this->validPlacements.reset();
90 Q_ASSERT(v->prev==
nullptr);
102 Q_ASSERT(this->
source!=
nullptr);
110 bool unreachabe = v->prev->prev && !v->prev->LR && !v->prev->BR;
115 frechet::FreeSpace::calculateFreeSpaceSegment<accurate_float>(
d.p1(), *v->prev, *v,
epsilon, v->L);
116 frechet::FreeSpace::calculateFreeSpaceSegment<accurate_float>(
d.p2(), *v->prev, *v,
epsilon, v->R);
117 frechet::FreeSpace::calculateFreeSpaceSegment<accurate_float>(*v->prev,
d.p1(),
d.p2(),
epsilon, v->B);
120 v->prev->prev ? &v->prev->L :
nullptr,
nullptr);
123 v->prev->prev ? &v->prev->R :
nullptr, &v->B);
126 if (v->prev->prev==
nullptr)
131 bool reachable=
false;
133 Q_ASSERT(v->target->fs.lower() >= 0.0);
134 Q_ASSERT(v->target->fs.upper() >= v->target->fs.lower());
138 FreeSpace::calculateFreeSpaceSegment<accurate_float>(*v,
d.p1(),
d.p2(),
epsilon, T);
157 reachable = v->RR.contains(1.0) || TR.contains(1.0);
182 bool lr = v->L.contains(0.0);
183 bool br = v->B.contains(0.0);
193 Q_ASSERT(!br && !lr);
225 if (v->prev->LR.contains(1.0) && v->L.contains(0.0))
232 else if (v->prev->BR && v->B)
237 if (v->BR || (v->prev->RR.contains(1.0) && v->R.contains(0.0)))
239 else if (v->LR && v->R)
269 int i = f->index(start_point);
292 if (i==0) std::cout <<
" apex=";
353 int hpt = halfplaneTest<accurate_float>(a,b,v);
364 int hpt = halfplaneTest<accurate_float>(a,b,v);
384 for(
int incr = 1; (incr < left) || (incr < right); incr*=2)
386 if ((incr < left) &&
isTangent(-left+incr,v))
390 if ((incr < right) &&
isTangent(right-incr,v))
413 while ((t1+1) < t2) {
433 while ((t1+1) < t2) {
460 throw std::exception();
Represents a polygon line segment from node i to j.
Triangulation & tri
the Triangulation
Triangulation::Face_handle Face_handle
static assert_hook1 after_target_found
unit test and debugging hook function; called when a target vertex is found
Triangulation::Vertex_handle Vertex_handle
Vertex_handle addTargetVertex(const frechet::reach::Placement *p)
add a vertex for computing valid placements
static void fixBorderCase(data::Interval *N, data::Interval *E, data::Interval *S, data::Interval *W)
fix border case at the joint of four intervals
int findTangentRight(int t1, int t2, Vertex_handle v) const
find a tangent from a point to the right part of the funnel
Triangulation::Face_circulator Face_circulator
const T & rightEnd() const
global definitions for all algorithms.
virtual bool updateSPSegment(Vertex_handle prev, Vertex_handle v) override
hook function that is called by the shortest-tree search whenever a new segment is added to the tree....
static Segment segment(Edge e)
const T & leftEnd() const
void(* assert_hook1)(PolygonShortestPathsFS *, Vertex_handle v, bool reachable)
static bool is_inner_face(Face_handle f)
double epsilon
free-space parameter epsilon
static bool is_polygon_edge(Edge e)
void findShortestPaths(Vertex_handle start_point)
traverse the polygon and report found paths
void undo(const Frame &fr)
undo an operation
const frechet::reach::Placement * source
source placement and
void resize(int sz)
reset number of vertexes in triangulation
Vertex_handle addVertex(double w)
add a triangulation vertex on the edge of the polygon (does not correspond to a polygon vertex)
void reset(const T &apex)
reset the qeueue with exactly one element
static Interval opposite(const Interval &LR, const Interval &RF)
void propagateReachability(Vertex_handle v)
update free-space and reachability info, called when a vertex is updated in the shortest-paths tree
void search(Vertex_handle start_point, Face_handle f)
compute the shortest-paths tree
bool isTangent(int t, Vertex_handle v) const
tangent test
PolygonShortestPathsFS(Triangulation &atri)
default constructor
Curve find1ShortestPath(double p1, double p2)
compute the shortest path between two points on the boundary of the polygon
void findShortestPaths(Vertex_handle start_point, const frechet::reach::Placement *asource, QLineF d, double epsilon, frechet::reach::Graph::ptr validPlacements)
void addLeft(const T &t)
push a new element to the left side of the queue
static assert_hook2 after_placement_added
unit test and debugging hook function; called when a valid placement is updated
int findTangentLeft(int t1, int t2, Vertex_handle v) const
find a tangent from a point to the left part of the funnel
void removeRightUpto(int t)
pop entries from the right end; Adjust the right end pointer and the apex, as necessary.
base class for vertexes in a Triangulation Data Structure.
void assertFunnel() const
assertion for unit testing: is the Funnel in a consistent state?
void removeLeftUpto(int t)
pop entries from the left end; Adjust the left end pointer and the apex, as necessary.
QPolygonF Curve
a polygonal curve in the plane; with double floating point precision. This type is heavily used throu...
boost::shared_ptr< Graph > ptr
void(* assert_hook2)(PolygonShortestPathsFS *, const frechet::reach::Placement *, const frechet::reach::Placement *)
void initReachability(Vertex_handle v)
set up reachability info for a triangulation vertex
placement of a diagonal point in free-space diagram When calculating valid placements in [buchin06]
Vertex_handle oppositeVertex(Edge e) const
the second vertex opposite to an edge. Keep in mind that Edge object are desribed as a Face + opposit...
compute Shortest-Paths-Tree on a polygon
PolygonShortestPaths(Triangulation &atri)
default constructor
void printFunnel(const PolygonShortestPaths::Funnel &funnel)
void addRight(const T &t)
push a new element to the right side of the queue
virtual bool updateSPSegment(Vertex_handle prev, Vertex_handle v)
called whenever a ne segment is added to the shortest path tree; hook for derived classes
Interval fs
Free-Space Interval.
Wrapper for CGAL::Triangulation_Data_Structure https://doc.cgal.org/latest/TDS_2/index....
TDS::Vertex_handle Vertex_handle
handle to a vertex (handles are managed by TDS base class)
int findTangent(Vertex_handle v) const
find a tangent from a point to the funnel
an interval of two double values.
void clearPredecessors()
used during shortest-paths computation: reset shortest-path tree information on all vertexes
frechet::reach::Graph::ptr validPlacements
result: holds the valid placements on return
IndexRange gn
mapping to nodes of the reachability graph (see GraphModel)