57 cout <<
"[Aleph Geometry Example] " << title <<
"\n";
58 cout <<
"============================================================\n";
80 cout << fixed << setprecision(3);
95 cout <<
"\nUnique sites: " << dt.
sites.size() << endl;
96 cout <<
"Delaunay triangles: " << dt.
triangles.size() << endl;
97 assert(dt.
sites.size() >= 3);
100 for (
size_t i = 0; i < dt.
triangles.size(); ++i)
103 cout <<
" T" << i <<
": [" << tr.i <<
", " << tr.j <<
", " << tr.k <<
"] ";
114 cout <<
"\nVoronoi vertices: " << vor.
vertices.size() << endl;
115 cout <<
"Voronoi edges: " << vor.
edges.size() << endl;
116 cout <<
"Voronoi cells (raw): " << vor.
cells.size() << endl;
123 cout <<
"Voronoi cells (clipped): " << clipped.
size() << endl;
124 assert(clipped.
size() == dt.
sites.size());
127 for (
size_t i = 0; i < clipped.
size(); ++i)
129 const auto & c = clipped(i);
130 assert(c.site_index == i);
131 assert(c.polygon.is_closed());
132 assert(c.polygon.size() >= 3);
133 assert(pip.
contains(c.polygon, c.site));
136 cout <<
"\nFirst 3 clipped cells:" << endl;
137 for (
size_t i = 0; i < clipped.
size()
and i < 3; ++i)
139 const auto & c = clipped(i);
140 cout <<
" cell[" << c.site_index <<
"] site=";
142 cout <<
" vertices=" << c.polygon.size() << endl;
145 cout <<
"\nValidation OK: clipped cells are indexed and contain their site." << endl;
146 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.
Exact Delaunay triangulation using the Bowyer-Watson incremental algorithm.
Doubly-linked list (defined in tpl_dynList.H).
T & append(const T &item)
Exact point-in-polygon classification via winding number.
static bool contains(const Polygon &poly, const Point &p)
Return true if the point is inside or on the boundary.
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.
Voronoi diagram derived as the dual of a Delaunay triangulation.
static Array< ClippedCell > clipped_cells_indexed(const Array< Point > &sites, const Polygon &clip)
Clip Voronoi cells and return explicit site-indexed records.
static Polygon make_clip_window()
static void print_point(const Point &p)
static void print_banner(const char *title)
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.
and
Check uniqueness with explicit hash + equality functors.
The result of a Delaunay triangulation.
Array< IndexedTriangle > triangles
Triangles forming the Delaunay triangulation.
Array< Point > sites
Unique, sorted input points used for triangulation.
The complete result of a Voronoi diagram computation.
Array< Edge > edges
Voronoi edges.
Array< Point > vertices
Voronoi vertices.
Array< Cell > cells
Voronoi cells.
Array< Point > sites
Input sites.