61 cout << fixed << setprecision(3);
62 cout <<
"[Aleph Geometry Example] Constrained Delaunay Triangulation\n";
63 cout <<
"============================================================\n";
84 cout <<
"\nUnique sites: " << result.sites.size() <<
endl;
85 cout <<
"Triangles: " << result.triangles.size() <<
endl;
86 cout <<
"Constrained edges: " << result.constrained_edges.size() <<
endl;
88 assert(result.sites.size() >= 8);
91 cout <<
"\nTriangles:" <<
endl;
92 for (
size_t i = 0; i < result.triangles.size(); ++i)
94 const auto &
tr = result.triangles(i);
95 cout <<
" T" << i <<
": [" <<
tr.i <<
", " <<
tr.j <<
", " <<
tr.k
105 cout <<
"\nConstrained edges:" <<
endl;
106 for (
size_t i = 0; i < result.constrained_edges.size(); ++i)
108 const auto & e = result.constrained_edges(i);
109 cout <<
" E" << i <<
": [" << e.u <<
", " << e.v <<
"] ";
119 for (
size_t t = 0; t < result.triangles.size(); ++t)
121 const auto & tri = result.triangles(t);
122 size_t vs[3] = {tri.i, tri.j, tri.k};
123 for (
int e = 0; e < 3; ++e)
124 if ((vs[e] ==
pu and vs[(e + 1) % 3] ==
pv)
or
125 (vs[e] ==
pv and vs[(e + 1) % 3] ==
pu))
131 for (
size_t i = 0; i < result.constrained_edges.size(); ++i)
133 const auto & e = result.constrained_edges(i);
139 assert(result.constrained_edges.size() >= 4);
146 cout <<
"\nValidation OK: all constraints present in CDT." <<
endl;
147 cout <<
"STATUS: OK" <<
endl;
Constrained Delaunay Triangulation via Sloan's flip-based method.
static DynList< Triangle > as_triangles(const Result &result)
Convert indexed triangulation to geometric triangles.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
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.
Represents a line segment between two points.
static void print_point(const Point &p)
Computational geometry algorithms.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.