55 argc > 1 ?
argv[1] :
"tikz_tree_structures_example.tex";
60 std::cerr <<
"Cannot open output file: " <<
output_path <<
'\n';
66 kd_plane.put_coordinate_grid(5, 5,
true);
74 "KD-tree partitions=" + std::to_string(
kd_snap.partitions.size())),
90 "Range-tree nodes=" + std::to_string(
rv.snapshot.nodes.size()) +
91 ", hits=" + std::to_string(
rv.query_hits.size())),
105 "AABB nodes=" + std::to_string(
av.snapshot.nodes.size()) +
106 ", hits=" + std::to_string(
av.query_hit_ids.size())),
110 out <<
"\\documentclass[tikz,border=8pt]{standalone}\n"
111 <<
"\\usepackage{tikz}\n"
112 <<
"\\begin{document}\n\n";
115 out <<
"\n\\vspace{4mm}\n\n";
117 out <<
"\n\\vspace{4mm}\n\n";
119 out <<
"\n\\end{document}\n";
122 std::cout <<
"Compile with: pdflatex " <<
output_path <<
'\n';
Axis-aligned bounding box tree for spatial queries.
size_t build(Array< size_t > &idx, const size_t lo, const size_t hi)
Simple dynamic array with automatic resizing and functional operations.
T & append(const T &data)
Append a copy of data
Dynamic singly linked list with functional programming support.
T & append(const T &item)
static KDTreePointSearch build(const Array< Point > &points, const Geom_Number &xmin, const Geom_Number &ymin, const Geom_Number &xmax, const Geom_Number &ymax)
Build a balanced KD-tree from a point array.
Represents a point with rectangular coordinates in a 2D plane.
Static 2D range tree for orthogonal range queries.
void build(const DynList< Point > &points)
Build the range tree from a point set.
An axis-aligned rectangle.
Represents a text string positioned at a 2D point.
2D TikZ canvas storing geometry objects and emitting LaTeX output.
static constexpr int Layer_Overlay
Main namespace for Aleph-w library functions.
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.
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.
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.
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.
Tikz_Style make_tikz_draw_style(const std::string &draw_color)
Create a basic draw style with a custom color.
Helpers to visualize computational-geometry algorithm results in TikZ.