45 for (
size_t i = 0; i < poly.
size(); ++i)
51int main(
int argc,
char * argv[])
53 const std::string output_path =
54 argc > 1 ? argv[1] :
"tikz_polygons_example.tex";
56 std::ofstream
out(output_path);
59 std::cerr <<
"Cannot open output file: " << output_path <<
'\n';
67 const Polygon convex = make_convex_polygon();
68 const Polygon concave = make_concave_polygon();
75 add_polygon_vertices(plane, convex);
76 add_polygon_vertices(plane, concave);
77 add_regular_polygon_vertices(plane, regular);
83 out <<
"\\documentclass[tikz,border=8pt]{standalone}\n"
84 <<
"\\usepackage{tikz}\n"
85 <<
"\\begin{document}\n\n";
89 out <<
"\n\\end{document}\n";
91 std::cout <<
"Generated " << output_path <<
'\n'
92 <<
"Compile with: pdflatex " << output_path <<
'\n';
size_t size_t int32_t * out
bool has_curr() const noexcept
Return true if the iterator has current item.
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.
A regular polygon defined by center, side length, and vertex count.
Point get_vertex(const size_t &i) const
Get the i-th vertex of the polygon.
const size_t & size() const
Get the number of vertices.
Represents a text string positioned at a 2D point.
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.
void put_cartesian_axis()
Enable Cartesian axes drawing (only when 0 lies in range).
void set_point_radius_mm(const double &radius_mm)
Configure point marker radius.
void add_polygon_vertices(SvgScene &scene, const ::Polygon &poly, const bool as_highlight=false)
Main namespace for Aleph-w library functions.
void put_in_plane(Tikz_Plane &plane, const Geom &geom_obj)
Insert any supported geometry type in a Tikz_Plane.
Iterator over the vertices of a polygon.
TikZ/LaTeX geometric drawing utilities.