Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tikzgeom_scene.H
Go to the documentation of this file.
1/*
2 Aleph_w
3
4 Data structures & Algorithms
5 version 2.0.0b
6 https://github.com/lrleon/Aleph-w
7
8 This file is part of Aleph-w library
9
10 Copyright (c) 2002-2026 Leandro Rabindranath Leon
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all
20 copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 SOFTWARE.
29*/
30
31# ifndef TIKZGEOM_SCENE_H
32# define TIKZGEOM_SCENE_H
33
34# include <ostream>
35# include <sstream>
36# include <string>
37# include <type_traits>
38# include <utility>
39# include <vector>
40
41# include "tikzgeom_algorithms.H"
42
43namespace Aleph
44{
45
48{
49 std::string document_class = "standalone";
50 std::string class_options = "tikz,border=8pt";
51 std::string extra_preamble;
52};
53
56{
58 std::string class_options = "aspectratio=169";
60 std::string frame_options = "t";
62 std::string frame_title = "TikZ Scene";
66 std::string extra_preamble;
67};
68
81{
83 const bool handout_mode,
84 const std::string & class_options)
85 {
86 if (not handout_mode)
87 return class_options;
88
89 if (class_options.empty())
90 return "handout";
91
92 if (class_options.find("handout") != std::string::npos)
93 return class_options;
94
95 return "handout," + class_options;
96 }
97
99 std::ostream & output,
101 const bool handout_mode)
102 {
103 output << "\\documentclass";
104
105 const std::string class_options =
107 if (not class_options.empty())
108 output << "[" << class_options << "]";
109
110 output << "{beamer}\n"
111 << "\\usepackage{tikz}\n";
112
113 if (options.hide_navigation_symbols)
114 output << "\\setbeamertemplate{navigation symbols}{}\n";
115
116 if (not options.extra_preamble.empty())
117 output << options.extra_preamble << '\n';
118
119 output << "\\begin{document}\n\n";
120 }
121
122 static void draw_beamer_document_epilogue(std::ostream & output)
123 {
124 output << "\n\\end{document}\n";
125 }
126
128 std::ostream & output,
129 const std::string & frame_title,
130 const std::string & frame_options)
131 {
132 output << "\\begin{frame}";
133 if (not frame_options.empty())
134 output << "[" << frame_options << "]";
135 output << "{" << frame_title << "}\n";
136 }
137
139 std::ostream & output,
140 const std::vector<Tikz_Scene> & steps,
142 const bool handout_mode)
143 {
145 draw_beamer_frame_begin(output, options.frame_title, options.frame_options);
146
147 if (steps.empty())
148 output << "\\centering\\small No overlays provided.\n";
149 else
150 for (size_t i = 0; i < steps.size(); ++i)
151 {
152 output << "\\only<" << (i + 1) << ">{\n";
153 steps[i].draw(output);
154 output << "}\n";
155 }
156
157 output << "\\end{frame}\n";
159 }
160
162 std::ostream & output,
164 const bool handout_mode) const
165 {
167 draw_beamer_frame(output, options.frame_title, options.frame_options);
169 }
170
172 bool squarize_ = true;
173
174public:
175 Tikz_Scene(const double width_mm,
176 const double height_mm,
177 const double xoffset_mm = 0.0,
178 const double yoffset_mm = 0.0,
179 const bool squarize = true)
182 {
183 }
184
185 [[nodiscard]] Tikz_Plane & plane() { return plane_; }
186 [[nodiscard]] const Tikz_Plane & plane() const { return plane_; }
187
188 [[nodiscard]] bool squarize() const { return squarize_; }
189 void set_squarize(const bool value) { squarize_ = value; }
190
192 {
193 plane_.clear();
194 return *this;
195 }
196
198 {
200 return *this;
201 }
202
204 {
206 return *this;
207 }
208
210 const double step_y = 1.0,
211 const bool draw_ticks = true)
212 {
214 return *this;
215 }
216
218 {
220 return *this;
221 }
222
224 {
226 return *this;
227 }
228
230 {
231 plane_.set_axis_style(style);
232 return *this;
233 }
234
236 {
237 plane_.set_grid_style(style);
238 return *this;
239 }
240
242 {
244 return *this;
245 }
246
247 Tikz_Scene & enable_native_tikz_layers(const bool enabled = true)
248 {
250 return *this;
251 }
252
253 Tikz_Scene & enable_auto_legend(const bool enabled = true)
254 {
255 plane_.enable_auto_legend(enabled);
256 return *this;
257 }
258
259 Tikz_Scene & add_legend_entry(const std::string & label,
260 const Tikz_Style & style)
261 {
262 plane_.add_legend_entry(label, style);
263 return *this;
264 }
265
267 {
269 return *this;
270 }
271
272 Tikz_Scene & register_tikz_style(const std::string & name,
273 const Tikz_Style & style)
274 {
275 plane_.register_tikz_style(name, style);
276 return *this;
277 }
278
279 template <typename Geom>
280 Tikz_Scene & add(const Geom & object)
281 {
282 put_in_plane(plane_, object);
283 return *this;
284 }
285
286 template <typename Geom>
287 Tikz_Scene & add(const Geom & object,
288 const Tikz_Style & style,
289 const int layer = Tikz_Plane::Layer_Default)
290 {
291 put_in_plane(plane_, object, style, layer);
292 return *this;
293 }
294
296 const Array<Point> & points,
297 const Tikz_Style & style = tikz_points_style("black"),
298 const int layer = Tikz_Plane::Layer_Default)
299 {
300 Aleph::put_points(plane_, points, style, layer);
301 return *this;
302 }
303
305 const DynList<Point> & points,
306 const Tikz_Style & style = tikz_points_style("black"),
307 const int layer = Tikz_Plane::Layer_Default)
308 {
309 Aleph::put_points(plane_, points, style, layer);
310 return *this;
311 }
312
314 const Array<Polygon> & polys,
315 const Tikz_Style & style = tikz_wire_style("black", true),
316 const int layer = Tikz_Plane::Layer_Default)
317 {
318 Aleph::put_polygons(plane_, polys, style, layer);
319 return *this;
320 }
321
322 template <typename Points, typename HullAlgorithm, typename... Args>
325 Args &&... args)
326 {
327 if constexpr (std::is_same_v<std::decay_t<Points>, Array<Point>>)
328 {
330 for (size_t i = 0; i < points.size(); ++i)
331 converted.append(points(i));
332
334 plane_,
335 converted,
336 std::forward<HullAlgorithm>(algorithm),
337 std::forward<Args>(args)...);
338 }
339 else
340 {
342 plane_,
343 points,
344 std::forward<HullAlgorithm>(algorithm),
345 std::forward<Args>(args)...);
346 }
347 }
348
349 template <typename... Args>
351 {
353 plane_, std::forward<Args>(args)...);
354 }
355
356 template <typename... Args>
358 {
360 plane_, std::forward<Args>(args)...);
361 }
362
363 template <typename... Args>
365 {
367 plane_, std::forward<Args>(args)...);
368 }
369
370 template <typename... Args>
372 {
374 plane_, std::forward<Args>(args)...);
375 }
376
377 template <typename... Args>
379 {
381 plane_, std::forward<Args>(args)...);
382 }
383
384 template <typename... Args>
390
391 template <typename... Args>
397
398 template <typename... Args>
400 {
402 plane_, std::forward<Args>(args)...);
403 }
404
405 template <typename... Args>
407 {
409 plane_, std::forward<Args>(args)...);
410 }
411
412 template <typename... Args>
414 {
416 plane_, std::forward<Args>(args)...);
417 }
418
419 template <typename... Args>
421 {
423 plane_, std::forward<Args>(args)...);
424 }
425
426 template <typename... Args>
428 {
430 plane_, std::forward<Args>(args)...);
431 }
432
433 template <typename... Args>
435 {
437 plane_, std::forward<Args>(args)...);
438 }
439
440 template <typename... Args>
442 {
444 plane_, std::forward<Args>(args)...);
445 }
446
447 template <typename... Args>
449 {
451 plane_, std::forward<Args>(args)...);
452 }
453
454 template <typename... Args>
456 {
458 plane_, std::forward<Args>(args)...);
459 }
460
461 template <typename... Args>
463 {
465 plane_, std::forward<Args>(args)...);
466 }
467
468 template <typename... Args>
470 {
472 plane_, std::forward<Args>(args)...);
473 }
474
475 template <typename... Args>
477 {
479 plane_, std::forward<Args>(args)...);
480 }
481
482 template <typename... Args>
484 {
486 plane_, std::forward<Args>(args)...);
487 }
488
489 template <typename... Args>
491 {
493 plane_, std::forward<Args>(args)...);
494 }
495
496 template <typename... Args>
498 {
500 plane_, std::forward<Args>(args)...);
501 }
502
503 template <typename... Args>
505 {
507 plane_, std::forward<Args>(args)...);
508 }
509
510 template <typename... Args>
512 {
513 Aleph::put_funnel_trace_step(plane_, std::forward<Args>(args)...);
514 }
515
516 template <typename Callable>
517 decltype(auto) run(Callable && callable)
518 {
519 return std::forward<Callable>(callable)(plane_);
520 }
521
522 template <typename Callable>
523 decltype(auto) run(Callable && callable) const
524 {
525 return std::forward<Callable>(callable)(plane_);
526 }
527
528 void draw(std::ostream & output) const
529 {
531 }
532
533 [[nodiscard]] std::string to_tikz() const
534 {
535 std::ostringstream out;
536 draw(out);
537 return out.str();
538 }
539
541 std::ostream & output,
542 const std::string & frame_title = "TikZ Scene",
543 const std::string & frame_options = "t") const
544 {
545 draw_beamer_frame_begin(output, frame_title, frame_options);
546
547 draw(output);
548 output << "\\end{frame}\n";
549 }
550
552 std::ostream & output,
553 const Tikz_Standalone_Document_Options & options = {}) const
554 {
555 output << "\\documentclass";
556 if (not options.class_options.empty())
557 output << "[" << options.class_options << "]";
558
559 output << "{";
560 if (options.document_class.empty())
561 output << "standalone";
562 else
563 output << options.document_class;
564 output << "}\n"
565 << "\\usepackage{tikz}\n";
566
567 if (not options.extra_preamble.empty())
568 output << options.extra_preamble << '\n';
569
570 output << "\\begin{document}\n\n";
571 draw(output);
572 output << "\n\\end{document}\n";
573 }
574
575 [[nodiscard]] std::string to_standalone(
576 const Tikz_Standalone_Document_Options & options = {}) const
577 {
578 std::ostringstream out;
580 return out.str();
581 }
582
584 std::ostream & output,
585 const Tikz_Beamer_Document_Options & options = {}) const
586 {
588 }
589
590 [[nodiscard]] std::string to_beamer(
591 const Tikz_Beamer_Document_Options & options = {}) const
592 {
593 std::ostringstream out;
595 return out.str();
596 }
597
599 std::ostream & output,
600 const Tikz_Beamer_Document_Options & options = {}) const
601 {
603 }
604
605 [[nodiscard]] std::string to_handout(
606 const Tikz_Beamer_Document_Options & options = {}) const
607 {
608 std::ostringstream out;
610 return out.str();
611 }
612
615 std::ostream & output,
616 const std::vector<Tikz_Scene> & steps,
618 {
620 }
621
623 [[nodiscard]] static std::string to_beamer_overlays(
624 const std::vector<Tikz_Scene> & steps,
626 {
627 std::ostringstream out;
629 return out.str();
630 }
631
634 std::ostream & output,
635 const std::vector<Tikz_Scene> & steps,
637 {
639 }
640
642 [[nodiscard]] static std::string to_handout_overlays(
643 const std::vector<Tikz_Scene> & steps,
645 {
646 std::ostringstream out;
648 return out.str();
649 }
650};
651
652} // namespace Aleph
653
654# endif // TIKZGEOM_SCENE_H
Simple dynamic array with automatic resizing and functional operations.
Definition tpl_array.H:139
Dynamic singly linked list with functional programming support.
Definition htlist.H:1155
T & append(const T &item)
Definition htlist.H:1271
size_t size() const noexcept
Count the number of elements of the list.
Definition htlist.H:1065
A general (irregular) 2D polygon defined by a sequence of vertices.
Definition polygon.H:246
2D TikZ canvas storing geometry objects and emitting LaTeX output.
Definition tikzgeom.H:184
void set_axis_style(const Tikz_Style &style)
Configure the style used to draw Cartesian axes.
Definition tikzgeom.H:1257
void draw(std::ostream &output, const bool squarize=true) const
Emit a complete tikzpicture with all inserted objects.
Definition tikzgeom.H:1383
void remove_coordinate_grid()
Disable coordinate grid rendering.
Definition tikzgeom.H:1316
void put_cartesian_axis()
Enable Cartesian axes drawing (only when 0 lies in range).
Definition tikzgeom.H:1291
static constexpr int Layer_Default
Definition tikzgeom.H:187
void clear()
Remove all inserted objects from the plane.
Definition tikzgeom.H:1359
void enable_auto_legend(const bool enabled=true)
Enable auto-legend generation from style colors.
Definition tikzgeom.H:1328
void enable_native_tikz_layers(const bool enabled=true)
Enable native PGF layers (\pgfdeclarelayer).
Definition tikzgeom.H:1322
void put_coordinate_grid(const double step_x=1.0, const double step_y=1.0, const bool draw_ticks=true)
Enable coordinate grid/ticks with user step sizes.
Definition tikzgeom.H:1303
void set_point_radius_mm(const double &radius_mm)
Configure point marker radius.
Definition tikzgeom.H:1275
void set_grid_style(const Tikz_Style &style)
Configure the style used to draw coordinate grids.
Definition tikzgeom.H:1265
void register_tikz_style(const std::string &name, const Tikz_Style &style)
Register a reusable \tikzset style for the rendered picture.
Definition tikzgeom.H:1346
void add_legend_entry(const std::string &label, const Tikz_Style &style)
Add a legend entry to be rendered in the top-left corner.
Definition tikzgeom.H:1334
void clear_legend()
Remove user-provided legend entries.
Definition tikzgeom.H:1340
void set_default_style(const Tikz_Style &style)
Configure the default style for subsequent non-styled inserts.
Definition tikzgeom.H:1249
void remove_cartesian_axis()
Disable Cartesian axes drawing.
Definition tikzgeom.H:1297
High-level scene wrapper to compose objects and algorithm visualizations.
Array< Polygon > visualize_convex_decomposition(Args &&... args)
Polygon visualize_convex_intersection(Args &&... args)
Tikz_Scene & clear()
auto visualize_closest_pair(Args &&... args)
Tikz_Scene & remove_coordinate_grid()
auto visualize_regular_triangulation(Args &&... args)
static void draw_beamer_frame_begin(std::ostream &output, const std::string &frame_title, const std::string &frame_options)
Tikz_Scene & put_coordinate_grid(const double step_x=1.0, const double step_y=1.0, const bool draw_ticks=true)
auto visualize_rotating_calipers(Args &&... args)
static void draw_beamer_document_preamble(std::ostream &output, const Tikz_Beamer_Document_Options &options, const bool handout_mode)
Tikz_Scene & enable_native_tikz_layers(const bool enabled=true)
std::string to_standalone(const Tikz_Standalone_Document_Options &options={}) const
static std::string to_handout_overlays(const std::vector< Tikz_Scene > &steps, const Tikz_Beamer_Document_Options &options={})
String variant of draw_handout_overlays.
static void draw_handout_overlays(std::ostream &output, const std::vector< Tikz_Scene > &steps, const Tikz_Beamer_Document_Options &options={})
Export multiple scenes as handout overlays (forces beamer[handout]).
auto visualize_half_plane_intersection(Args &&... args)
decltype(auto) run(Callable &&callable)
Tikz_Plane & plane()
static void draw_beamer_document_epilogue(std::ostream &output)
void draw_standalone(std::ostream &output, const Tikz_Standalone_Document_Options &options={}) const
Tikz_Scene & enable_auto_legend(const bool enabled=true)
std::string to_tikz() const
auto visualize_segment_arrangement(Args &&... args)
Tikz_Scene & add(const Geom &object, const Tikz_Style &style, const int layer=Tikz_Plane::Layer_Default)
auto visualize_line_sweep(Args &&... args)
static void draw_beamer_overlays_document(std::ostream &output, const std::vector< Tikz_Scene > &steps, const Tikz_Beamer_Document_Options &options, const bool handout_mode)
decltype(auto) run(Callable &&callable) const
Tikz_Scene & put_cartesian_axis()
auto visualize_visibility_polygon(Args &&... args)
auto visualize_minkowski_sum(Args &&... args)
Tikz_Scene & set_axis_style(const Tikz_Style &style)
Tikz_Scene & add_legend_entry(const std::string &label, const Tikz_Style &style)
void set_squarize(const bool value)
DynList< Point > visualize_shortest_path_in_polygon(Args &&... args)
Array< Polygon > visualize_boolean_operation(Args &&... args)
auto visualize_range_tree_query(Args &&... args)
void put_funnel_trace_step(Args &&... args)
void draw_beamer_frame(std::ostream &output, const std::string &frame_title="TikZ Scene", const std::string &frame_options="t") const
Tikz_Scene & set_default_style(const Tikz_Style &style)
const Tikz_Plane & plane() const
Tikz_Scene & add(const Geom &object)
auto visualize_voronoi(Args &&... args)
Tikz_Scene & clear_legend()
std::string to_handout(const Tikz_Beamer_Document_Options &options={}) const
auto visualize_range_tree(Args &&... args)
bool squarize() const
Tikz_Scene & register_tikz_style(const std::string &name, const Tikz_Style &style)
Tikz_Scene & add_points(const Array< Point > &points, const Tikz_Style &style=tikz_points_style("black"), const int layer=Tikz_Plane::Layer_Default)
static std::string compose_beamer_class_options(const bool handout_mode, const std::string &class_options)
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.
auto visualize_aabb_tree(Args &&... args)
Tikz_Scene & add_polygons(const Array< Polygon > &polys, const Tikz_Style &style=tikz_wire_style("black", true), const int layer=Tikz_Plane::Layer_Default)
Tikz_Scene & remove_cartesian_axis()
void draw_handout(std::ostream &output, const Tikz_Beamer_Document_Options &options={}) const
void draw_beamer(std::ostream &output, const Tikz_Beamer_Document_Options &options={}) const
void draw_beamer_document(std::ostream &output, const Tikz_Beamer_Document_Options &options, const bool handout_mode) const
static std::string to_beamer_overlays(const std::vector< Tikz_Scene > &steps, const Tikz_Beamer_Document_Options &options={})
String variant of draw_beamer_overlays.
Tikz_Scene(const double width_mm, const double height_mm, const double xoffset_mm=0.0, const double yoffset_mm=0.0, const bool squarize=true)
auto visualize_aabb_tree_query(Args &&... args)
auto visualize_kdtree_partitions(Args &&... args)
Polygon visualize_convex_hull(const Points &points, HullAlgorithm &&algorithm, Args &&... args)
Tikz_Scene & add_points(const DynList< Point > &points, const Tikz_Style &style=tikz_points_style("black"), const int layer=Tikz_Plane::Layer_Default)
AlphaShape::Result visualize_alpha_shape(Args &&... args)
auto visualize_monotone_triangulation(Args &&... args)
Tikz_Scene & set_grid_style(const Tikz_Style &style)
auto visualize_delaunay(Args &&... args)
ShortestPathDebugResult visualize_shortest_path_with_portals(Args &&... args)
void draw(std::ostream &output) const
auto visualize_power_diagram(Args &&... args)
Tikz_Scene & set_point_radius_mm(const double radius_mm)
std::string to_beamer(const Tikz_Beamer_Document_Options &options={}) const
Main namespace for Aleph-w library functions.
Definition ah-arena.H:89
AABBTreeQueryVizResult visualize_aabb_tree_query(Tikz_Plane &plane, const AABBTree &tree, const Rectangle &query_rect, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_wire_style("red"))
Visualize AABB tree with a rectangle query overlay.
void put_in_plane(Tikz_Plane &plane, const Geom &geom_obj)
Insert any supported geometry type in a Tikz_Plane.
Definition tikzgeom.H:1456
Polygon visualize_convex_intersection(Tikz_Plane &plane, const Polygon &subject, const Polygon &clip, const ConvexPolygonIntersectionBasic &intersection_algorithm={}, const Tikz_Style &subject_style=tikz_area_style("blue", "blue!15", 0.45), const Tikz_Style &clip_style=tikz_area_style("orange", "orange!20", 0.45), const Tikz_Style &result_style=tikz_area_style("red", "red!30", 0.60), const int input_layer=Tikz_Plane::Layer_Default, const int result_layer=Tikz_Plane::Layer_Foreground)
Visualizes the intersection of two convex polygons.
AlphaShape::Result visualize_alpha_shape(Tikz_Plane &plane, const DynList< Point > &points, const Geom_Number &alpha_squared, const AlphaShape &algorithm={}, const bool draw_kept_triangles=false, const Tikz_Style &triangle_style=tikz_wire_style("gray!55"), const Tikz_Style &boundary_style=tikz_path_style("orange!90!black"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
Compute and insert alpha-shape for input points.
void put_funnel_trace_step(Tikz_Plane &plane, const Polygon &polygon, const Point &source, const Point &target, const FunnelTraceResult &trace, size_t step_index, const Tikz_Style &polygon_style=tikz_area_style("black", "gray!15", 0.22), const Tikz_Style &source_style=tikz_points_style("green!50!black"), const Tikz_Style &target_style=tikz_points_style("blue"), const Tikz_Style &all_portals_style=tikz_wire_style("purple", true), const Tikz_Style &active_portal_style=tikz_path_style("purple"), const Tikz_Style &funnel_leg_style=tikz_path_style("orange!90!black"), const Tikz_Style &committed_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int portal_layer=Tikz_Plane::Layer_Foreground, const int highlight_layer=Tikz_Plane::Layer_Overlay)
Render one funnel-trace frame in a plane.
AABBTree::DebugSnapshot visualize_aabb_tree(Tikz_Plane &plane, const AABBTree &tree, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"))
Visualize AABB tree hierarchy.
RangeTreeQueryVizResult visualize_range_tree_query(Tikz_Plane &plane, const RangeTree2D &tree, const Rectangle &query_rect, const bool draw_points=true, const Tikz_Style &split_style=tikz_wire_style("purple"), const Tikz_Style &point_style=tikz_points_style("black"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_points_style("red"))
Visualize range-tree plus a query rectangle and matching points.
PowerDiagram::Result visualize_power_diagram(Tikz_Plane &plane, const Array< PowerDiagram::WeightedSite > &sites, const PowerDiagram &algorithm={}, const bool draw_cells=true, const Tikz_Style &cell_style=tikz_area_style("violet", "violet!18", 0.35), const Tikz_Style &edge_style=tikz_wire_style("violet"), const Tikz_Style &site_style=tikz_points_style("purple"))
Compute and insert Power diagram for weighted sites.
DelaunayTriangulationBowyerWatson::Result visualize_delaunay(Tikz_Plane &plane, const DynList< Point > &points, const DelaunayTriangulationBowyerWatson &algorithm={}, const Tikz_Style &triangle_style=tikz_wire_style("blue"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
Compute and insert Delaunay triangulation as triangle outlines.
RangeTree2D::DebugSnapshot visualize_range_tree(Tikz_Plane &plane, const RangeTree2D &tree, const bool draw_points=true, const Tikz_Style &split_style=tikz_wire_style("purple"), const Tikz_Style &point_style=tikz_points_style("black"))
Visualize range-tree structure without a query overlay.
VoronoiDiagram::Result visualize_voronoi(Tikz_Plane &plane, const DynList< Point > &sites, const VoronoiDiagram &algorithm={}, const bool draw_cells=false, const Tikz_Style &cell_style=tikz_area_style("gray!50!black", "gray!15", 0.35), const Tikz_Style &edge_style=tikz_wire_style("black"), const Tikz_Style &unbounded_edge_style=tikz_wire_style("black", true, true), const Tikz_Style &site_style=tikz_points_style("red"), const Geom_Number &unbounded_ray_length=Geom_Number(50))
Compute and insert Voronoi diagram for input sites.
RegularTriangulationBowyerWatson::Result visualize_regular_triangulation(Tikz_Plane &plane, const Array< RegularTriangulationBowyerWatson::WeightedSite > &weighted_sites, const RegularTriangulationBowyerWatson &algorithm={}, const Tikz_Style &triangle_style=tikz_wire_style("blue!60"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
Compute and insert regular (weighted Delaunay) triangulation.
Polygon visualize_half_plane_intersection(Tikz_Plane &plane, const Array< HalfPlaneIntersection::HalfPlane > &halfplanes, const HalfPlaneIntersection &algorithm={}, const Tikz_Style &boundary_style=tikz_wire_style("gray!60", true, true), const Tikz_Style &result_style=tikz_area_style("red", "red!25", 0.50))
Compute and draw bounded half-plane intersection.
Polygon visualize_visibility_polygon(Tikz_Plane &plane, const Polygon &polygon, const Point &query_point, const VisibilityPolygon &algorithm={}, const Tikz_Style &polygon_style=tikz_wire_style("black"), const Tikz_Style &visibility_style=tikz_area_style("orange!90!black", "orange!25", 0.50), const Tikz_Style &query_style=tikz_points_style("red"))
Compute and draw visibility polygon from a query point.
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.
ShortestPathDebugResult visualize_shortest_path_with_portals(Tikz_Plane &plane, const Polygon &polygon, const Point &source, const Point &target, const ShortestPathInPolygon &algorithm={}, const Tikz_Style &polygon_style=tikz_area_style("black", "gray!15", 0.25), const Tikz_Style &source_style=tikz_points_style("green!50!black"), const Tikz_Style &target_style=tikz_points_style("blue"), const Tikz_Style &portal_style=tikz_wire_style("purple", true), const Tikz_Style &path_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int portal_layer=Tikz_Plane::Layer_Foreground, const int path_layer=Tikz_Plane::Layer_Overlay)
Visualize the shortest path plus funnel portals.
Array< SweepLineSegmentIntersection::Intersection > visualize_line_sweep(Tikz_Plane &plane, const Array< Segment > &segments, const SweepLineSegmentIntersection &algorithm={}, const Tikz_Style &segment_style=tikz_wire_style("blue!60"), const Tikz_Style &intersection_style=tikz_points_style("red"))
Compute and draw Bentley-Ottmann line-sweep intersections.
KDTreePointSearch::DebugSnapshot visualize_kdtree_partitions(Tikz_Plane &plane, const KDTreePointSearch &kd_tree, const bool draw_partition_boxes=false, const bool draw_points=true, const Tikz_Style &partition_style=tikz_wire_style("gray!55", true), const Tikz_Style &split_style=tikz_wire_style("blue!70"), const Tikz_Style &point_style=tikz_points_style("red"))
Visualize KD-tree recursive space partitions.
void put_points(Tikz_Plane &plane, const Array< Point > &pts, const Tikz_Style &style=tikz_points_style(), const int layer=Tikz_Plane::Layer_Default)
Inserts all points from an Array<Point> into the plane.
void put_polygons(Tikz_Plane &plane, const Array< Polygon > &polys, const Tikz_Style &style=tikz_wire_style(), const int layer=Tikz_Plane::Layer_Default)
Inserts all polygons from an Array<Polygon> into the plane.
DynList< Point > visualize_shortest_path_in_polygon(Tikz_Plane &plane, const Polygon &polygon, const Point &source, const Point &target, const ShortestPathInPolygon &algorithm={}, const Tikz_Style &polygon_style=tikz_area_style("black", "gray!15", 0.25), const Tikz_Style &source_style=tikz_points_style("green!50!black"), const Tikz_Style &target_style=tikz_points_style("blue"), const Tikz_Style &path_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int path_layer=Tikz_Plane::Layer_Foreground)
Visualize the shortest path inside a simple polygon.
ClosestPairDivideAndConquer::Result visualize_closest_pair(Tikz_Plane &plane, const DynList< Point > &points, const ClosestPairDivideAndConquer &algorithm={}, const Tikz_Style &points_style=tikz_points_style("black"), const Tikz_Style &pair_style=tikz_path_style("red"), const Tikz_Style &pair_points_style=tikz_points_style("red"))
Compute and draw the closest pair from an input point set.
RotatingCalipersResult visualize_rotating_calipers(Tikz_Plane &plane, const Polygon &polygon, const Tikz_Style &polygon_style=tikz_wire_style("gray!55"), const Tikz_Style &diameter_style=tikz_path_style("red"), const Tikz_Style &width_style=tikz_path_style("blue"), const Tikz_Style &witness_style=tikz_points_style("orange!90!black"))
Compute and draw rotating-calipers diameter and minimum width.
Tikz_Style tikz_wire_style(const std::string &color="black", const bool dashed=false, const bool with_arrow=false)
Creates a style optimized for wireframe segments and polygons.
SegmentArrangement::Result visualize_segment_arrangement(Tikz_Plane &plane, const Array< Segment > &segments, const SegmentArrangement &algorithm={}, const bool draw_faces=true, const bool draw_vertices=true, const bool draw_unbounded_face=false, const Tikz_Style &face_style=tikz_area_style("teal!60!black", "teal!12", 0.30), const Tikz_Style &edge_style=tikz_wire_style("teal!70!black"), const Tikz_Style &vertex_style=tikz_points_style("teal!70!black"), const bool color_faces_by_index=false)
Compute and insert arrangement for input segments.
Polygon visualize_minkowski_sum(Tikz_Plane &plane, const Polygon &first, const Polygon &second, const MinkowskiSumConvex &algorithm={}, const Tikz_Style &first_style=tikz_area_style("blue", "blue!14", 0.30), const Tikz_Style &second_style=tikz_area_style("green!60!black", "green!16", 0.30), const Tikz_Style &result_style=tikz_area_style("red", "red!26", 0.60))
Compute and draw Minkowski sum of two convex polygons.
Array< Polygon > visualize_boolean_operation(Tikz_Plane &plane, const Polygon &a, const Polygon &b, const BooleanPolygonOperations::Op op, const BooleanPolygonOperations &bop={}, const Tikz_Style &a_style=tikz_area_style("blue", "blue!15", 0.35), const Tikz_Style &b_style=tikz_area_style("green!60!black", "green!20", 0.35), const Tikz_Style &result_style=tikz_area_style("red", "red!35", 0.65), const int input_layer=Tikz_Plane::Layer_Default, const int result_layer=Tikz_Plane::Layer_Foreground)
Visualizes a boolean operation (union, intersection, difference) on two polygons.
DynList< Triangle > visualize_monotone_triangulation(Tikz_Plane &plane, const Polygon &polygon, const MonotonePolygonTriangulation &algorithm={}, const Tikz_Style &polygon_style=tikz_wire_style("black"), const Tikz_Style &triangle_style=tikz_wire_style("blue!65"))
Compute and draw triangulation via monotone partition pipeline.
Polygon visualize_convex_hull(Tikz_Plane &plane, const DynList< Point > &points, const HullAlgorithm &hull_algorithm, const Tikz_Style &point_style=tikz_points_style("black", 0.6), const Tikz_Style &hull_style=tikz_wire_style("red"), const Tikz_Style &hull_vertex_style=tikz_points_style("red"), const int point_layer=Tikz_Plane::Layer_Default, const int hull_layer=Tikz_Plane::Layer_Foreground, const bool draw_hull_vertices=true)
Runs a convex hull algorithm and visualizes the result.
Tikz_Style tikz_points_style(const std::string &color="black", const double opacity=-1.0)
Creates a style optimized for point clouds.
Array< Polygon > visualize_convex_decomposition(Tikz_Plane &plane, const Polygon &polygon, const ConvexPolygonDecomposition &algorithm={}, const bool draw_input_polygon=true, const Tikz_Style &input_style=tikz_wire_style("black", true), const bool color_parts_by_index=true, const Tikz_Style &part_style=tikz_area_style("blue!60!black", "blue!15", 0.40), const int input_layer=Tikz_Plane::Layer_Default, const int part_layer=Tikz_Plane::Layer_Foreground)
Compute and insert convex decomposition for a polygon.
static struct argp_option options[]
Definition ntreepic.C:1886
Result of an alpha-shape computation.
Result bundle for shortest-path + funnel portal visualization.
Options used by Tikz_Scene beamer/handout export helpers.
std::string frame_title
Frame title used by scene exports.
std::string extra_preamble
Extra LaTeX preamble lines inserted before \\begin{document}.
std::string class_options
beamer class options (for example aspectratio=169).
std::string frame_options
Frame options passed to \\begin{frame}[...].
bool hide_navigation_symbols
Whether to hide navigation symbols (\\setbeamertemplate).
Options used by Tikz_Scene standalone document export.
Style descriptor for TikZ primitives.
Definition tikzgeom.H:86
DynList< Point > Points
Helpers to visualize computational-geometry algorithm results in TikZ.
ofstream output
Definition writeHeap.C:215