38 scene.put_cartesian_axis()
39 .set_point_radius_mm(0.70);
43void put_step_title(
Tikz_Scene & scene,
const std::string & text)
52int main(
int argc,
char * argv[])
54 std::string output_path =
"tikz_scene_overlays_example.tex";
57 for (
int i = 1; i < argc; ++i)
59 const std::string arg = argv[i];
60 if (arg ==
"--handout")
66 std::ofstream
out(output_path);
69 std::cerr <<
"Cannot open output file: " << output_path <<
'\n';
73 const Polygon a = make_polygon_a();
74 const Polygon b = make_polygon_b();
76 std::vector<Tikz_Scene>
steps;
83 put_step_title(scene,
"Step 1/3: input polygons A and B");
84 steps.push_back(scene);
98 "Step 2/3: convex intersection, vertices=" + std::to_string(inter.
size()));
99 steps.push_back(scene);
107 BooleanPolygonOperations::Op::UNION,
114 "Step 3/3: boolean union, components=" + std::to_string(united.
size()));
115 steps.push_back(scene);
121 opts.
frame_title = handout ?
"TikZ Scene Overlays (Handout)"
122 :
"TikZ Scene Overlays (Beamer)";
129 std::cout <<
"Generated " << output_path <<
'\n'
130 <<
"Mode: " << (handout ?
"handout" :
"beamer") <<
'\n'
131 <<
"Overlays: " <<
steps.size() <<
'\n'
132 <<
"Compile with: pdflatex " << output_path <<
'\n';
size_t size_t int32_t * out
Simple dynamic array with automatic resizing and functional operations.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
Boolean operations on simple polygons (union, intersection, difference) using the Greiner-Hormann alg...
Basic exact intersection for closed convex polygons.
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.
const size_t & size() const
Get the number of vertices.
Represents a text string positioned at a 2D point.
static constexpr int Layer_Default
static constexpr int Layer_Overlay
High-level scene wrapper to compose objects and algorithm visualizations.
Polygon visualize_convex_intersection(Args &&... args)
static void draw_handout_overlays(std::ostream &output, const std::vector< Tikz_Scene > &steps, const Tikz_Beamer_Document_Options &options={})
Export the final overlay scene as a static handout frame.
Array< Polygon > visualize_boolean_operation(Args &&... args)
Tikz_Scene & add(const Geom &object)
static void draw_beamer_overlays(std::ostream &output, const std::vector< Tikz_Scene > &steps, const Tikz_Beamer_Document_Options &options={})
Export multiple scenes as beamer overlays (\\only<k>{...}) in one frame.
Main namespace for Aleph-w library functions.
Tikz_Style make_tikz_draw_style(const std::string &draw_color)
Create a basic draw style with a custom color.
Tikz_Style tikz_area_style(const std::string &draw_color="black", const std::string &fill_color="gray!25", const double opacity=0.6)
Creates a style for drawing filled polygons.
Options used by Tikz_Scene beamer/handout export helpers.
std::string frame_title
Frame title used by scene exports.
std::string class_options
beamer class options (for example aspectratio=169).
std::string frame_options
Frame options passed to \\begin{frame}[...].
High-level scene management for TikZ geometry visualization.