31#ifndef ALEPH_TEST_GEOM_ALGORITHMS_TEST_COMMON_H
32#define ALEPH_TEST_GEOM_ALGORITHMS_TEST_COMMON_H
34#include <gtest/gtest.h>
54 if (it.get_current_vertex() == p)
72 return (a == u
and b == v)
or (a == v
and b == u);
130 for (
size_t i = 0; i <
r.triangles.size(); ++i)
132 size_t a =
r.triangles(i).i;
133 size_t b =
r.triangles(i).j;
134 size_t c =
r.triangles(i).k;
136 out.append(TriKey{a, b, c});
176 <<
"circumcenter_of: collinear triangle (zero area)";
204 if (a < 0) { a = -a; }
228 if (a < 0) { a = -a; }
241 for (
auto it = points.
get_it(); it.has_curr(); it.next_ne())
243 loc == PointInPolygonWinding::Location::Outside)
259 verts.append(it.get_current_vertex());
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
Simple dynamic array with automatic resizing and functional operations.
void reserve(size_t cap)
Reserves cap cells into the array.
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic singly linked list with functional programming support.
static bool is_convex(const Array< Point > &verts)
Check if a vertex array forms a convex polygon.
static Geom_Number signed_double_area(const Array< Point > &verts)
Compute twice the signed area (shoelace formula without division).
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.
const size_t & size() const
Get the number of vertices.
A non-degenerate triangle defined by three points.
Geom_Number area() const
Calculates the unsigned area of the triangle.
auto get_it() const
Return a properly initialized iterator positioned at the first item on the container.
Computational geometry algorithms.
double triangle_area(const Triangle &t)
Calculate area of a triangle using cross product.
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.
void quicksort_op(C< T > &a, const Compare &cmp=Compare(), const size_t threshold=Quicksort_Threshold)
Optimized quicksort for containers using operator().
static Geom_Number polygon_area(const Polygon &poly)
The result of a Delaunay triangulation.
Iterator over the vertices of a polygon.