26 #ifndef __POLY_GRID_PARTITION_H
27 #define __POLY_GRID_PARTITION_H
33 #include <unordered_map>
36 #include <geometry/seg.h>
37 #include <geometry/shape_line_chain.h>
38 #include <geometry/shape_rect.h>
39 #include <math/vector2d.h>
72 int ContainsPoint(
const VECTOR2I& aP,
int aClearance = 0 );
74 const BOX2I& BBox()
const
86 using EDGE_LIST = std::vector<int>;
89 inline void hash_combine(
std::size_t& seed,
const T& v )
92 seed ^= hasher( v ) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
97 bool operator()(
const SEG& a,
const SEG& b )
const
99 return (a.A == b.A && a.B == b.B) || (a.A == b.B && a.B == b.A);
107 return a.A.x + a.B.x + a.A.y + a.B.y;
111 int containsPoint(
const VECTOR2I& aP,
bool debug =
false )
const;
113 bool checkClearance(
const VECTOR2I& aP,
int aClearance );
115 int rescale_trunc(
int aNumerator,
int aValue,
int aDenominator )
const;
120 int grid2polyX(
int x )
const;
122 int grid2polyY(
int y )
const;
126 int poly2gridX(
int x )
const;
128 int poly2gridY(
int y )
const;
132 bool inRange(
int v1,
int v2,
int x )
const;
150 void scanCell( SCAN_STATE& state,
const EDGE_LIST& cell,
const VECTOR2I& aP,
int cx,
157 std::vector<int> m_flags;
158 std::vector<EDGE_LIST> m_grid;
Provide a fast test for point inside polygon.
Definition: poly_grid_partition.h:68
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition: shape_line_chain.h:81
std::integral_constant< std::size_t, N > size_t
An integral constant wrapper for std::size_t.
Definition: meta.hpp:163