9 const size_t u,
const size_t v)
11 for (
size_t t = 0; t <
r.triangles.size(); ++t)
13 const auto & tri =
r.triangles(t);
14 size_t vs[3] = {tri.i, tri.j, tri.k};
15 for (
int e = 0; e < 3; ++e)
17 const size_t a = vs[e], b = vs[(e + 1) % 3];
18 if ((a == u
and b == v)
or (a == v
and b == u))
28 for (
size_t i = 0; i < sites.
size(); ++i)
41 if (u == ~
static_cast<size_t>(0)
or v == ~
static_cast<size_t>(0))
44 for (
size_t i = 0; i <
r.constrained_edges.size(); ++i)
46 const auto & e =
r.constrained_edges(i);
47 if ((e.u == u
and e.v == v)
or (e.u == v
and e.v == u))
60 struct EdgeKey {
size_t u, v; };
62 for (
size_t i = 0; i <
r.constrained_edges.size(); ++i)
64 const auto & e =
r.constrained_edges(i);
65 const size_t a = e.u < e.v ? e.u : e.v;
66 const size_t b = e.u < e.v ? e.v : e.u;
72 if (a > b) {
const size_t t = a; a = b; b = t; }
73 for (
size_t i = 0; i <
con_edges.size(); ++i)
81 for (
size_t t1 = 0;
t1 <
r.triangles.size(); ++
t1)
83 const auto &
tri1 =
r.triangles(
t1);
86 for (
int e = 0; e < 3; ++e)
88 const size_t ea =
vs1[e],
eb =
vs1[(e + 1) % 3];
93 for (
size_t t2 =
t1 + 1;
t2 <
r.triangles.size(); ++
t2)
95 const auto &
tri2 =
r.triangles(
t2);
100 for (
int f = 0; f < 3; ++f)
102 const size_t fa =
vs2[f],
fb =
vs2[(f + 1) % 3];
118 if (
o == Orientation::COLLINEAR)
125 if (
o == Orientation::CCW
and det > 0)
127 if (
o == Orientation::CW
and det < 0)
159 Point a(0, 0), b(4, 0), c(4, 4), d(0, 4);
186 Point a(0, 0), b(6, 0), c(3, 5);
204 Point a(0, 0), b(2, 1), c(4, 0), d(2, -1);
227 Point a(0, 0), b(6, 0), c(6, 6), d(0, 6), e(3, 3);
231 pts.append(d);
pts.append(e);
254 Point p0(0, 0), p1(2, 3), p2(4, 0), p3(6, 3), p4(8, 0);
258 pts.append(p3);
pts.append(p4);
325 Point a(0, 0), b(4, 0), c(2, 3);
348 Point a(0, 0), b(2, 0), c(4, 0), d(2, 3);
372 Point a(0, 0), b(4, 0), c(2, 3);
376 pts.append(a);
pts.append(b);
389 Point a(0, 0), b(4, 0), c(2, 3);
414 Point p0(0, 0), p1(5, 0), p2(5, 5), p3(0, 5);
434 for (
size_t i = 0; i < result.constrained_edges.size(); ++i)
436 const auto & e = result.constrained_edges(i);
438 <<
"Constrained edge (" << e.u <<
"," << e.v <<
") not in triangulation";
449 Point p0(0, 0), p1(6, 0), p2(6, 6), p3(0, 6), p4(3, 3);
453 pts.append(p3);
pts.append(p4);
463 <<
"Delaunay property violated for non-constrained edges";
468 Point a(0, 0), b(4, 0), c(4, 4), d(0, 4), e(2, 2);
472 pts.append(d);
pts.append(e);
489 Point p0(0, 0), p1(6, 0), p2(6, 4), p3(0, 4), p4(3, 2);
493 pts.append(p3);
pts.append(p4);
502 for (
size_t t = 0; t < result.triangles.size(); ++t)
504 const auto & tri = result.triangles(t);
507 result.sites(tri.k));
508 EXPECT_NE(
o, Orientation::COLLINEAR) <<
"Degenerate triangle " << t;
520 for (
int y = 0;
y < 4; ++
y)
521 for (
int x = 0; x < 4; ++x)
526 for (
int y = 0;
y < 3; ++
y)
527 for (
int x = 0; x < 3; ++x)
537 for (
int y = 0;
y < 3; ++
y)
538 for (
int x = 0; x < 3; ++x)
546 Point p0(2, 0), p1(4, 1.5), p2(3, 4), p3(1, 4), p4(0, 1.5);
551 pts.append(p3);
pts.append(p4);
pts.append(center);
575 Point a(0, 0), b(4, 0), c(2, 3);
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
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)
size_t size() const noexcept
Count the number of elements of the list.
Represents a point with rectangular coordinates in a 2D plane.
Represents a line segment between two points.
TEST_F(GeomAlgorithmsTest, CDT_TriangleNoConstraints)
static bool cdt_has_edge(const ConstrainedDelaunayTriangulation::Result &r, const size_t u, const size_t v)
static bool has_constrained_edge(const ConstrainedDelaunayTriangulation::Result &r, const Point &p, const Point &q)
static bool check_delaunay_for_non_constrained(const ConstrainedDelaunayTriangulation::Result &r)
static size_t find_site(const Array< Point > &sites, const Point &p)
and
Check uniqueness with explicit hash + equality functors.
Orientation
Classification of three-point orientation.
Geom_Number in_circle_determinant(const Point &a, const Point &b, const Point &c, const Point &p)
Return the exact in-circle determinant for (a,b,c,p).
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.
Orientation orientation(const Point &a, const Point &b, const Point &c)
Return the orientation of the triple (a, b, c).