Fawkes API  Fawkes Development Version
fawkes::NavGraphGeneratorVoronoi Class Reference

Generate navgraph using a Voronoi diagram. More...

#include <>>

Public Member Functions

 NavGraphGeneratorVoronoi ()
 Default constructor. More...
 
 NavGraphGeneratorVoronoi (float bbox_p1_x, float bbox_p1_y, float bbox_p2_x, float bbox_p2_y, float near_threshold)
 Constructor with bounding box. More...
 
virtual ~NavGraphGeneratorVoronoi ()
 Destructor. More...
 
virtual void compute (fawkes::LockPtr< fawkes::NavGraph > graph)
 Compute graph. More...
 
void set_bounding_box (float bbox_p1_x, float bbox_p1_y, float bbox_p2_x, float bbox_p2_y)
 Set bounding box. More...
 
void set_near_threshold (float near_threshold)
 Set distance threshold for considering nodes to be the same. More...
 
void add_obstacle (float x, float y)
 Add an obstacle point. More...
 
void clear ()
 Clear all obstacle points. More...
 
const std::list< Polygon2D > & face_polygons () const
 Get list of polygons. More...
 

Detailed Description

Generate navgraph using a Voronoi diagram.

Author
Tim Niemueller

Definition at line 35 of file voronoi.h.

Constructor & Destructor Documentation

◆ NavGraphGeneratorVoronoi() [1/2]

fawkes::NavGraphGeneratorVoronoi::NavGraphGeneratorVoronoi ( )

Default constructor.

Definition at line 67 of file voronoi.cpp.

◆ NavGraphGeneratorVoronoi() [2/2]

fawkes::NavGraphGeneratorVoronoi::NavGraphGeneratorVoronoi ( float  bbox_p1_x,
float  bbox_p1_y,
float  bbox_p2_x,
float  bbox_p2_y,
float  near_threshold 
)

Constructor with bounding box.

This constructor will cause compute() to ignore any edge with a vertex out of the given bounding box area.

Parameters
bbox_p1_xX coordinate of first (lower) bounding box point
bbox_p1_yy coordinate of first (lower) bounding box point
bbox_p2_xX coordinate of second (upper) bounding box point
bbox_p2_yy coordinate of second (upper) bounding box point
near_thresholddistance threshold for which to consider nodes to be the same if the distance is smaller than this threshold.

Definition at line 85 of file voronoi.cpp.

◆ ~NavGraphGeneratorVoronoi()

fawkes::NavGraphGeneratorVoronoi::~NavGraphGeneratorVoronoi ( )
virtual

Destructor.

Definition at line 97 of file voronoi.cpp.

Member Function Documentation

◆ add_obstacle()

void fawkes::NavGraphGeneratorVoronoi::add_obstacle ( float  x,
float  y 
)

Add an obstacle point.

An obstacle point will be the representative for a Voronoi face in the newly generated graph.

Parameters
xX coordinate of point
yY coordinate of point

Definition at line 181 of file voronoi.cpp.

Referenced by NavGraphGeneratorThread::loop().

◆ clear()

void fawkes::NavGraphGeneratorVoronoi::clear ( void  )

Clear all obstacle points.

Definition at line 189 of file voronoi.cpp.

◆ compute()

void fawkes::NavGraphGeneratorVoronoi::compute ( fawkes::LockPtr< fawkes::NavGraph graph)
virtual

Compute graph.

Parameters
graphthe resulting nodes and edges will be added to this graph. The graph will not be cleared automatically. The graph will be locked while adding nodes.

Definition at line 202 of file voronoi.cpp.

References fawkes::NavGraph::add_edge(), fawkes::NavGraph::add_node(), fawkes::NavGraph::calc_reachability(), fawkes::contains(), fawkes::genname(), fawkes::LockPtr< T_CppObject >::lock(), fawkes::NavGraph::nodes(), fawkes::polygon_area(), fawkes::polygon_contains(), and fawkes::LockPtr< T_CppObject >::unlock().

Referenced by NavGraphGeneratorThread::loop().

◆ face_polygons()

const std::list<Polygon2D>& fawkes::NavGraphGeneratorVoronoi::face_polygons ( ) const
inline

Get list of polygons.

Returns
list of polygons, each polygon contains the vertices of a bounded face of the Voronoi diagram.

Definition at line 56 of file voronoi.h.

◆ set_bounding_box()

void fawkes::NavGraphGeneratorVoronoi::set_bounding_box ( float  bbox_p1_x,
float  bbox_p1_y,
float  bbox_p2_x,
float  bbox_p2_y 
)

Set bounding box.

Setting a bounding box will cause compute() to ignore any edge with a vertex out of the given bounding box area.

Parameters
bbox_p1_xX coordinate of first (lower) bounding box point
bbox_p1_yy coordinate of first (lower) bounding box point
bbox_p2_xX coordinate of second (upper) bounding box point
bbox_p2_yy coordinate of second (upper) bounding box point

Definition at line 153 of file voronoi.cpp.

Referenced by NavGraphGeneratorThread::loop().

◆ set_near_threshold()

void fawkes::NavGraphGeneratorVoronoi::set_near_threshold ( float  near_threshold)

Set distance threshold for considering nodes to be the same.

Parameters
near_thresholddistance threshold for which to consider nodes to be the same if the distance is smaller than this threshold.

Definition at line 169 of file voronoi.cpp.


The documentation for this class was generated from the following files: