56 cout <<
"[Aleph Geometry Example] " << title <<
"\n";
57 cout <<
"============================================================\n";
69 v.
append(it.get_current_vertex());
71 for (
size_t i = 0; i < v.
size(); ++i)
73 const Point & a = v(i);
91 const Point & p = it.get_current_vertex();
120 file << fixed << setprecision(8);
121 file <<
"name,vertex_count,area,wkt\n";
138 cout << name <<
" (vertices=" << poly.
size()
139 <<
", closed=" << (poly.
is_closed() ?
"yes" :
"no") <<
")" <<
endl;
142 const Vertex & p = it.get_current_vertex();
174 cout <<
"Intersection area = " <<
area_inter <<
" (exact rational)" <<
endl;
188 cout <<
"Disjoint case validated: intersection is empty." <<
endl;
191 (
argc > 1) ?
argv[1] :
"polygon_intersection_output.csv";
195 cout <<
"Warning: cannot export CSV to: " <<
csv_path <<
endl;
197 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
void reserve(size_t cap)
Reserves cap cells into the array.
Basic exact intersection for closed convex polygons.
bool has_curr() const noexcept
Return true if the iterator has current 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.
A general (irregular) 2D polygon defined by a sequence of vertices.
void add_vertex(const Point &point)
Add a vertex to the polygon.
void close()
Close the polygon.
const bool & is_closed() const
Check if the polygon is closed.
const size_t & size() const
Get the number of vertices.
A vertex in a polygon's doubly linked vertex list.
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.
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.
static void print_polygon(const char *name, const Polygon &poly)
static bool export_csv(const char *path, const Polygon &subject, const Polygon &clip, const Polygon &inter)
static Geom_Number polygon_area(const Polygon &poly)
static void write_polygon_wkt(ostream &out, const Polygon &poly)
static void print_banner(const char *title)
Iterator over the vertices of a polygon.