PointLocation.hpp
Vá para a documentação deste arquivo.
1 
4 #include <vector>
5 
6 #include "../persistence/RedBlackTree.hpp"
7 
8 
9 namespace point_location {
10 
12 struct Point {
14  double x;
16  double y;
17 
18  bool operator < (const Point &o) const;
19  bool operator == (const Point &o) const;
20  Point operator - (const Point &o) const;
21 };
22 
23 typedef std::vector<Point> Polygon;
24 
29 struct Segment {
30  Segment();
31  Segment(Point a, Point b, int pol);
36 
37  /* A qual polígono pertence este segmento */
38  int polygon;
39 
40  /* Se o segmento é da parte "de cima" do polígono */
41  bool top;
42 
48  bool operator < (const Segment &o) const;
49 };
50 
53  public:
54 
61  PointLocationSolver(std::vector<Polygon> polygons);
62 
68  int WhichPolygon(Point p) const;
69 
70  private:
72  std::vector<std::pair<Point, int>> slabs;
73 };
74 
75 } // namespace point_location
Um ponto em 2D.
Definition: PointLocation.hpp:12
PointLocationSolver(std::vector< Polygon > polygons)
Construtor.
Um segmento em 2D Garantimos que from.x ≤ to.x.
Definition: PointLocation.hpp:29
double x
Coordenada X.
Definition: PointLocation.hpp:14
Árvore rubro-negra (ARN) parcialmente persistente.
Definition: RedBlackTree.hpp:123
Point to
Ponto de fim.
Definition: PointLocation.hpp:35
int WhichPolygon(Point p) const
Consulta de ponto.
Point from
Ponto de origem.
Definition: PointLocation.hpp:33
Estrutura usada para resolver o problema de Point Location.
Definition: PointLocation.hpp:52
double y
Coordenada Y.
Definition: PointLocation.hpp:16
bool operator<(const Segment &o) const
Comparação de segmentos.