54 cout <<
"[Aleph Geometry Example] " << title <<
"\n";
55 cout <<
"============================================================\n";
62 case PointInPolygonWinding::Location::Inside:
return "Inside";
63 case PointInPolygonWinding::Location::Boundary:
return "Boundary";
64 case PointInPolygonWinding::Location::Outside:
return "Outside";
105 for (
size_t i = 0; i < queries.
size(); ++i)
107 const Point & p = queries(i);
108 const auto loc = pip.
locate(poly, p);
113 assert(pip.
locate(poly, queries(0)) == PointInPolygonWinding::Location::Inside);
114 assert(pip.
locate(poly, queries(1)) == PointInPolygonWinding::Location::Outside);
115 assert(pip.
locate(poly, queries(2)) == PointInPolygonWinding::Location::Boundary);
116 assert(pip.
locate(poly, queries(3)) == PointInPolygonWinding::Location::Outside);
117 assert(pip.
locate(poly, queries(4)) == PointInPolygonWinding::Location::Inside);
119 cout <<
"\nValidation OK: inside / boundary / outside classifications match." << endl;
120 cout <<
"STATUS: OK" << endl;
Simple dynamic array with automatic resizing and functional operations.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
T & append(const T &data)
Append a copy of data
Exact point-in-polygon classification via winding number.
static Location locate(const Polygon &poly, const Point &p)
Classify point location with respect to a polygon.
Represents a point with rectangular coordinates in a 2D plane.
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
A general (irregular) 2D polygon defined by a sequence of vertices.
void add_vertex(const Point &point)
Add a vertex to the polygon.
void close()
Close the polygon.
Computational geometry algorithms.
Main namespace for Aleph-w library functions.
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.
static Polygon build_concave_polygon()
static const char * to_cstr(const PointInPolygonWinding::Location loc)
static void print_banner(const char *title)