32 argc > 1 ?
argv[1] :
"tikz_funnel_animation_example.tex";
37 std::cerr <<
"Cannot open output file: " <<
output_path <<
'\n';
42 const Point source(2, 16);
43 const Point target(22, 16);
48 out <<
"\\documentclass[a4paper]{article}\n"
49 <<
"\\usepackage[margin=12mm]{geometry}\n"
50 <<
"\\usepackage{tikz}\n"
51 <<
"\\pagestyle{empty}\n"
52 <<
"\\begin{document}\n\n";
54 if (
trace.steps.size() == 0)
57 frame.put_cartesian_axis();
58 frame.set_point_radius_mm(0.75);
65 "No funnel iterations (direct/degenerate case), portals=" +
66 std::to_string(
debug.portals.size())),
75 for (
size_t i = 0; i <
trace.steps.size(); ++i)
78 frame.put_cartesian_axis();
79 frame.set_point_radius_mm(0.75);
99 std::string
event =
"tighten";
100 if (
step.emitted_left)
event =
"emit-left";
101 else if (
step.emitted_right)
event =
"emit-right";
102 else if (
step.tightened_left
and step.tightened_right)
event =
"tighten-both";
103 else if (
step.tightened_left)
event =
"tighten-left";
104 else if (
step.tightened_right)
event =
"tighten-right";
108 "Funnel step " + std::to_string(i + 1) +
109 "/" + std::to_string(
trace.steps.size()) +
110 ", portal=" + std::to_string(
step.portal_index) +
117 if (i + 1 <
trace.steps.size())
118 out <<
"\n\\newpage\n\n";
121 out <<
"\n\\newpage\n\n";
132 "Final shortest path with portals: path nodes=" +
133 std::to_string(
debug.path.size())),
141 out <<
"\\end{document}\n";
144 <<
"Frames: " <<
trace.steps.size() <<
" + final summary page" <<
'\n'
145 <<
"Compile with: pdflatex " <<
output_path <<
'\n';
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.
Compute the shortest Euclidean path between two points inside a simple polygon.
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.
and
Check uniqueness with explicit hash + equality functors.
void put_in_plane(Tikz_Plane &plane, const Geom &geom_obj)
Insert any supported geometry type in a Tikz_Plane.
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.
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.
Tikz_Style tikz_path_style(const std::string &color="red", const bool with_arrow=false)
Creates a style optimized for polyline paths.
Tikz_Style make_tikz_draw_style(const std::string &draw_color)
Create a basic draw style with a custom color.
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.
FunnelTraceResult compute_shortest_path_funnel_trace(const Polygon &polygon, const Point &source, const Point &target)
Compute a full SSFA trace (portal-by-portal states).
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.
Tikz_Style tikz_points_style(const std::string &color="black", const double opacity=-1.0)
Creates a style optimized for point clouds.
Full trace for shortest-path funnel processing.
One SSFA (funnel) iteration snapshot.
Helpers to visualize computational-geometry algorithm results in TikZ.