1#ifndef SRC_PLANNING_INCLUDE_PLANNING_DELAUNY_MIDPOINT_GENERATOR_HPP_
2#define SRC_PLANNING_INCLUDE_PLANNING_DELAUNY_MIDPOINT_GENERATOR_HPP_
4#include <CGAL/Delaunay_triangulation_2.h>
5#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
7#include <rclcpp/rclcpp.hpp>
15using K = CGAL::Exact_predicates_inexact_constructions_kernel;
16using DT = CGAL::Delaunay_triangulation_2<K>;
58 std::vector<std::shared_ptr<Midpoint>>&
generate_midpoints(
const std::vector<Cone>& cone_array,
59 bool rebuild_all_midpoints);
98 std::vector<std::shared_ptr<Cone>>& filtered_cones,
bool rebuild_all_midpoints);
114 std::vector<std::shared_ptr<Cone>>& filtered_cones,
115 std::map<std::pair<int, int>, std::shared_ptr<Midpoint>>& segment_to_midpoint);
123 const std::array<std::shared_ptr<Midpoint>, 3>& triangle_midpoints);
133 int find_cone(std::vector<std::shared_ptr<Cone>>& cones,
double x,
double y);
Generates midpoints between cones using Delaunay triangulation.
MidpointGenerator(const MidpointGeneratorConfig &config)
Constructs a new MidpointGenerator with a specific configuration.
int find_cone(std::vector< std::shared_ptr< Cone > > &cones, double x, double y)
Finds a cone in a vector based on its position coordinates.
void connect_triangle_midpoints(const std::array< std::shared_ptr< Midpoint >, 3 > &triangle_midpoints)
Connects midpoints that belong to the same Delaunay triangle.
void filter_cones(const std::vector< Cone > &cone_array, std::vector< std::shared_ptr< Cone > > &filtered_cones, bool rebuild_all_midpoints)
Filters input cones based on proximity to the vehicle pose.
std::shared_ptr< Midpoint > process_triangle_edge(const Vertex_handle &va, const Vertex_handle &vb, std::vector< std::shared_ptr< Cone > > &filtered_cones, std::map< std::pair< int, int >, std::shared_ptr< Midpoint > > &segment_to_midpoint)
Processes a single edge of a Delaunay triangle and creates its midpoint if valid.
void set_vehicle_pose(const Pose &vehicle_pose)
Updates the vehicle pose for dynamic filtering.
MidpointGeneratorConfig config_
std::vector< std::shared_ptr< Midpoint > > & generate_midpoints(const std::vector< Cone > &cone_array, bool rebuild_all_midpoints)
Generates midpoints from a set of cones.
MidpointGenerator()=default
Default constructor.
std::vector< std::pair< Point, Point > > triangulations_
std::vector< std::shared_ptr< Midpoint > > midpoints_
const std::vector< std::pair< Point, Point > > & get_triangulations() const
Returns the current set of Delaunay edges used for visualization.
CGAL::Exact_predicates_inexact_constructions_kernel K
CGAL::Delaunay_triangulation_2< K > DT
DT::Vertex_handle Vertex_handle
Configuration parameters for the Midpoint Generator class.
MidPoint struct represents a potential path point with connections.
Struct for pose representation.