PGROUTING  3.2
pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp} Namespace Reference

Classes

struct  CompareRadius
 

Typedefs

typedef std::pair< Triangle, double > MyPairType
 

Functions

Bpoint circumcenter (const Bpoint a, const Bpoint b, const Bpoint c)
 
double det (double r00, double r01, double r10, double r11)
 
template<typename B_G , typename V >
Bpoly get_polygon (V source, V target, const std::vector< V > &predecessors, const B_G &graph, std::set< E > &edges_used)
 
template<typename B_G , typename V >
std::vector< Vget_predecessors (V source, V target, const B_G &subg)
 

Typedef Documentation

◆ MyPairType

typedef std::pair<Triangle, double> pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp}::MyPairType

Definition at line 154 of file pgr_alphaShape.cpp.

Function Documentation

◆ circumcenter()

Bpoint pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp}::circumcenter ( const Bpoint  a,
const Bpoint  b,
const Bpoint  c 
)

Definition at line 73 of file pgr_alphaShape.cpp.

73  {
74  auto cx = c.x();
75  auto cy = c.y();
76  auto ax = a.x() - cx;
77  auto ay = a.y() - cy;
78  auto bx = b.x() - cx;
79  auto by = b.y() - cy;
80 
81  auto denom = 2 * det(ax, ay, bx, by);
82  /*
83  * If denom == 0 then points are colinear
84  */
85  pgassert(denom != 0);
86 
87  auto numx = det(ay, ax * ax + ay * ay, by, bx * bx + by * by);
88  auto numy = det(ax, ax * ax + ay * ay, bx, bx * bx + by * by);
89 
90  return Bpoint {cx - numx / denom, cy + numy / denom};
91 }

References det(), and pgassert.

Referenced by pgrouting::alphashape::Pgr_alphaShape::radius().

◆ det()

double pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp}::det ( double  r00,
double  r01,
double  r10,
double  r11 
)

Definition at line 68 of file pgr_alphaShape.cpp.

68  {
69  return r00 * r11 - r01 * r10;
70 }

Referenced by circumcenter().

◆ get_polygon()

template<typename B_G , typename V >
Bpoly pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp}::get_polygon ( V  source,
V  target,
const std::vector< V > &  predecessors,
const B_G &  graph,
std::set< E > &  edges_used 
)

Definition at line 127 of file pgr_alphaShape.cpp.

127  {
128  Bpoly polygon;
129  /*
130  * There is no path -> returning empty polygon
131  */
132  if (target == predecessors[target]) {
133  pgassert(bg::num_points(polygon) == 0);
134  return polygon;
135  }
136 
137  /*
138  * the last stop is the target
139  */
140  bg::append(polygon.outer(), graph[source].point);
141 
142  /*
143  * get the path
144  */
145  while (target != source || target != predecessors[target]) {
146  bg::append(polygon.outer(), graph[target].point);
147  edges_used.insert(boost::edge(predecessors[target], target, graph).first);
148  target = predecessors[target];
149  }
150  bg::correct(polygon);
151  return polygon;
152 }

References pgassert.

Referenced by pgrouting::alphashape::Pgr_alphaShape::operator()().

◆ get_predecessors()

template<typename B_G , typename V >
std::vector<V> pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp}::get_predecessors ( V  source,
V  target,
const B_G &  subg 
)

Definition at line 95 of file pgr_alphaShape.cpp.

95  {
96  pgassert(boost::num_vertices(subg));
97  std::vector<V> predecessors(boost::num_vertices(subg));
98  std::vector<double> distances(num_vertices(subg));
99  pgassert(predecessors.size() == boost::num_vertices(subg));
100  pgassert(distances.size() == boost::num_vertices(subg));
101 
102  /* abort in case of an interruption occurs (e.g. the query is being cancelled) */
103  CHECK_FOR_INTERRUPTS();
104 
105  try {
106  boost::dijkstra_shortest_paths(subg, source,
107  boost::predecessor_map(&predecessors[0])
108  .weight_map(get(&Basic_edge::cost, subg))
109  .distance_map(&distances[0])
110  .visitor(visitors::dijkstra_one_goal_visitor<V>(target)));
111  } catch(found_goals &) {
112  } catch (boost::exception const& ex) {
113  (void)ex;
114  throw;
115  } catch (std::exception &e) {
116  (void)e;
117  throw;
118  } catch (...) {
119  throw;
120  }
121  return predecessors;
122 }

References pgrouting::Basic_edge::cost, and pgassert.

Referenced by pgrouting::alphashape::Pgr_alphaShape::operator()().

pgrouting::Bpoly
bg::model::polygon< Bpoint > Bpoly
Definition: bline.hpp:46
pgrouting::Bpoint
bg::model::d2::point_xy< double > Bpoint
Definition: bline.hpp:40
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94
pgrouting::alphashape::anonymous_namespace{pgr_alphaShape.cpp}::det
double det(double r00, double r01, double r10, double r11)
Definition: pgr_alphaShape.cpp:68