21 if (!std::isnan(aneps))
22 fs->calculateFreeSpace(aneps);
37 Q_ASSERT(G->graphModel()==
gmodel);
40 int p = G->foundDiagonalElement();
44 double start = (start_ival.
lower()+start_ival.
upper())/2;
45 start = fmod(start,
fs->n-1);
59 Q_ASSERT(k.first <= k.second);
67 if (
fix.size()>1 &&
fix.last().x()==start)
68 fix.last().ry() =
fs->m-1;
78 if (M->origin.operation==Graph::Origin::MERGE2)
89 Q_ASSERT(k >= k1 && k <= k2);
103 Q_ASSERT(A->graphModel()==
gmodel);
104 Q_ASSERT(B->graphModel()==
gmodel);
108 Q_ASSERT(ival1.lower() < ival2.
upper());
142 else if (q.
lower() >
fix.last().y()) {
150 Q_ASSERT(q.
upper() > y1);
151 y = (y1+q.
upper())/2;
159 if (!
fix.empty() && p==
fix.last())
166 QPointF last =
fix.last();
167 Q_ASSERT(p.x() != last.x());
168 Q_ASSERT(p.y() > last.y());
177 const std::vector<Interval>& reverse =
gmodel->reverseMap(o);
178 return reverse[p % reverse.size()];
195 Q_ASSERT(A->origin.operation==Graph::Origin::RG);
205 if (ival1.
upper() <= 0.0)
continue;
210 for (; !r2.empty(); r2 = B->find_next_range(
VERTICAL, k1,
VERTICAL, r2.upper))
217 if (ival2.
lower() >=
fs->m - 1)
continue;
269 for(
int i=0; i <
fix.size(); ++i) {
270 Q_ASSERT(
fix.indexOf(
fix[i])==i);
275 for(
int i=1; i <
fix.size(); ++i)
277 Q_ASSERT(
fix[i].y() >
fix[i-1].y());
278 if (
fix[i].x() <
fix[i-1].x()) wrapped++;
279 Q_ASSERT(
fix[i].x() >
fix[i-1].x() || (wrapped==1));
bool wrapTop
free-space wraps at top, Q is closed
double mapPoint(Orientation o, int p) const
map a node of a reachability graph to a point in the free-space interval.
global definitions for all algorithms.
IndexPair findSolutionConnectingPoints(Graph::ptr A, int i, Graph::ptr B) const
given the solution of the simple polygon algorithm, drill down to the original graphs and find the fi...
boost::shared_ptr< GraphModel > ptr
smart pointer to a GraphModel object
double mapFromQToP(int q) const
GraphModel::ptr gmodel
model for mapping free-space intervals to reachability graph nodes
Curve findShortestPathP(int qa, int qb, Triangulation &tri)
given a diagonal in Q, compute the mapped shortest-path in P.
int upper
upper index (exclusive)
int lower
lower index (inclusive)
Curve find1ShortestPath(double p1, double p2)
compute the shortest path between two points on the boundary of the polygon
void drillDown(Graph::ptr res)
Drill down, starting from the solution Graph, replacing diagonals step by step. Until finally we have...
QPointF Point
a point in the plane; with double floating point precision. This type is heavily used throughout all ...
std::pair< int, int > IndexPair
QPolygonF Curve
a polygonal curve in the plane; with double floating point precision. This type is heavily used throu...
an integer iterator that goes in "spirals", like this:
a range of node indices in a Reachability Graph
Orientation
Segment Orientation.
boost::shared_ptr< Graph > ptr
void addFixPoint(int pi, int qi)
add a fix point to the feasible path
Interval mapInterval(Orientation o, int p) const
map a node of a reachability graph to the associated free-space interval
static bool is_consistent(Curve fix)
for debugging only; test the consistency of a feasible path. It must be monotone in both x- and y-coo...
int findConnectingPoint(Graph::ptr A, int ia, Graph::ptr B, int ib) const
given two reachability graphs, drill down to the original graphs and find the fixed points of the fea...
void calculatePath()
calculate the feasible path
compute Shortest-Paths-Tree on a polygon
PolygonFSPath(FreeSpace::ptr fs)
constructor with free-space
bool contains(double x) const
containment test (assumes closed interval, bounds inclusive)
Wrapper for CGAL::Triangulation_Data_Structure https://doc.cgal.org/latest/TDS_2/index....
an interval of two double values.
static double pickIntervalPoint(const Interval &j, int m=INT_MAX)
pick a point from a free-space interval. Helper function for creating feasible paths.
Curve findShortestPathQ(int pa, int pb, Triangulation &tri)
given a diagonal in P, compute the mapped shortest-path in Q
FreeSpace::ptr fs
underlying free-space
static bool is_adjacent_to(const Graph &A, const Graph &B)
boost::shared_ptr< FreeSpace > ptr
smart pointer to FreeSpace object
Calculates a feasible path in the Free-Space given a start point (0,0) and an end point (n-1,...
double mapFromPToQ(int p) const
double max(double a, double b)
maximum function with checks for NAN
void update(const Graph::ptr result, double epsilon)
compute a feasible path from the results of the simple polygon algorithm