54 cout <<
"[Aleph Geometry Example] " << title <<
"\n";
55 cout <<
"============================================================\n";
70 for (
size_t i = 0; i < arr.
size(); ++i)
71 for (
size_t j = i + 1; j < arr.
size(); ++j)
72 if (
const Geom_Number d2 = arr(i).distance_squared_to(arr(j)); d2 <
best)
99 cout <<
"Closest pair: (" <<
r.first.get_x() <<
", " <<
r.first.get_y() <<
") and "
100 <<
"(" <<
r.second.get_x() <<
", " <<
r.second.get_y() <<
")" <<
endl;
101 cout <<
"distance^2 = " <<
r.distance_squared <<
endl;
105 cout <<
"Brute-force distance^2 = " <<
brute_d2 <<
endl;
108 cout <<
"Validation OK: divide-and-conquer matches brute force." <<
endl;
116 cout <<
"Duplicate-point scenario validated: distance^2 = 0." <<
endl;
117 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
Closest pair of points via divide and conquer.
Iterator on the items of list.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
bool has_curr() const noexcept
Represents a point with rectangular coordinates in a 2D plane.
static void print_banner(const char *title)
static Geom_Number brute_distance_squared(const DynList< Point > &pts, Point &out_a, Point &out_b)
Computational geometry algorithms.
Main namespace for Aleph-w library functions.
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.