47 for (
int i = 0; i < 10; ++i)
79 for (
size_t k = 1;
k <= 4; ++
k)
83 cout <<
" iter " <<
k <<
": " <<
sv.size() <<
" vertices" <<
endl;
89 cout <<
"L-shape: " <<
l_verts.size() <<
" vertices" <<
endl;
91 for (
size_t k = 1;
k <= 3; ++
k)
95 cout <<
" iter " <<
k <<
": " <<
sv.size() <<
" vertices" <<
endl;
99 ofstream
tex(
"chaikin_smoothing_output.tex");
100 tex <<
"\\documentclass[border=5mm]{standalone}\n"
101 <<
"\\usepackage{tikz}\n"
102 <<
"\\usepackage{subcaption}\n"
103 <<
"\\begin{document}\n"
104 <<
"\\begin{figure}\n";
111 tex <<
"\\begin{minipage}{0.45\\textwidth}\\centering\n";
113 tex <<
"\\captionof{subfigure}{" <<
caption <<
"}\n"
114 <<
"\\end{minipage}\\hfill\n";
121 tex <<
"\n\\medskip\n\n";
127 tex <<
"\n\\bigskip\n\n";
133 tex <<
"\n\\medskip\n\n";
139 tex <<
"\\end{figure}\n"
140 <<
"\\end{document}\n";
142 cout <<
"TikZ output written to chaikin_smoothing_output.tex" <<
endl;
static Polygon make_L_shape()
Build an L-shaped polygon.
static Polygon smooth_polygon(const Polygon &poly, size_t iterations, const Geom_Number &ratio=Geom_Number(1, 4))
Smooth a closed polygon.
static Array< Point > extract_vertices(const Polygon &poly)
Extract vertices from a polygon into an array for indexed access.
Represents a point with rectangular coordinates in a 2D plane.
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.
2D TikZ canvas storing geometry objects and emitting LaTeX output.
void draw(std::ostream &output, const bool squarize=true) const
Emit a complete tikzpicture with all inserted objects.
static Polygon make_star()
Star-shaped polygon with 5 reflex vertices.
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_cos_function > > cos(const __gmp_expr< T, U > &expr)
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_sin_function > > sin(const __gmp_expr< T, U > &expr)
Main namespace for Aleph-w library functions.
void put_smoothing_result(Tikz_Plane &plane, const Polygon &original, const Polygon &smoothed, const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &smoothed_style=tikz_wire_style("violet!80", 1.2), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
Draw original and smoothed polygons overlaid.
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.
Helpers to visualize computational-geometry algorithm results in TikZ.