59 cout <<
"[Aleph Geometry Example] " << title <<
"\n";
60 cout <<
"============================================================\n";
89 verts.append(it.get_current_vertex());
102 for (
size_t i = 0; i <
verts.size(); ++i)
108 for (
size_t i = 0; i <
unique.size(); ++i)
118template <
typename Algo>
122 const auto t0 = chrono::high_resolution_clock::now();
124 const auto t1 = chrono::high_resolution_clock::now();
125 micros = chrono::duration<double, std::micro>(
t1 -
t0).count();
127 cout <<
" " << setw(28) << left << name
128 <<
" vertices=" << setw(3) <<
h.size()
129 <<
" time=" << fixed << setprecision(2) <<
micros <<
" us" <<
endl;
138 cout <<
"Input points: " <<
pts.size() <<
endl;
159 cout <<
"\nReference signature (Andrew): " <<
ref <<
endl;
166 cout <<
"All 5 algorithms produced the same hull vertex set." <<
endl;
167 cout <<
"STATUS: OK" <<
endl;
Andrew's monotonic chain convex hull algorithm.
Simple dynamic array with automatic resizing and functional operations.
void reserve(size_t cap)
Reserves cap cells into the array.
Brute force convex hull algorithm.
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
Gift wrapping (Jarvis march) convex hull algorithm.
Graham scan convex hull algorithm.
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.
QuickHull convex hull algorithm.
static Polygon timed_hull(const char *name, Algo &algo, const DynList< Point > &pts, double µs)
static DynList< Point > build_point_set()
static string hull_signature(const Polygon &poly)
static void print_banner(const char *title)
Computational geometry algorithms.
Main namespace for Aleph-w library functions.
Itor unique(Itor __first, Itor __last, BinaryPredicate __binary_pred=BinaryPredicate())
Remove consecutive duplicates in place.
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().
Iterator over the vertices of a polygon.