#include <Voronoi.h>
Public Member Functions | |
Voronoi () | |
~Voronoi () | |
void | insert (Position p) |
adds a point to the voronoi diagram | |
bool | valid () |
valid if voronoi diagram has 2 or more regions | |
bool | scanToFill (Scan &scan, Angle angRangeMin, Angle angRangeMax, Angle angRes) |
check if the scan needs to be filled | |
void | fillScan (Scan &scan, Decimal linRangeMax, Angle angRes) |
fills the scan with the max range when passing from 240° to 360° | |
vector< Position > | intersectScan (Scan &scan, Position p, Decimal limitedRange, bool limitedRangeOn=true, bool useSectors=true) |
find the intersection between: the scan, the voronoi region, a disk | |
Position | centroid () |
find centroid | |
Position | weightedNormal (Decimal limitedRange, Decimal limitedRangeEps, Angle angRes, bool limitTarget=true) |
compute a point on the direction where the robot can increase the area of its voronoi region | |
Position | circumCenter (Decimal &radius) |
compute the circumcenter | |
void | clear () |
clear the voronoi diagram | |
void | setGV (CGAL::Geomview_stream *gvs) |
set the pointer to the Geomview stream | |
void | setDW (DraWin *dwp, unsigned int dwpList) |
set the pointer to the DraWin source | |
void | setDWPose (Pose dwpPose) |
set orientation and position (pose) needed for rototranslation in draWin | |
void | setDWPointSize (Decimal s) |
set the size of points | |
void | setDWDiskSize (Decimal s) |
set the size of disk | |
void | setDWColor (Color c) |
set the color | |
void | drawDiagram () |
draw the voronoi diagram | |
void | drawSites () |
draw sites of the voronoi diagram | |
void | drawDisk (Position p) |
draw disk | |
void | drawSegment (Position source, Position target) |
draw a segment | |
void | drawCircle (Position center, Decimal radius, int sampling=1) |
draw circle | |
void | drawScan (int sampling=1) |
draw scan | |
void | drawLimitedScan (int sampling=1) |
draw limited scan | |
void | drawVoronoiScan (int sampling=1) |
draw voronoi scan | |
void | drawVoronoiScanPoints (int sampling=1) |
draw voronoi scan points | |
void | drawRegionEdges (Position p) |
draw region edges | |
void | drawRegionSectors (Position center, Decimal radius, int sampling=1) |
draw region edge sectors | |
bool | clearPlot () |
clear the plot | |
Position | pointToPosition (Point_2 point) |
convert a Point_2 to a Position | |
Point_2 | positionToPoint (Position point) |
convert a Position to a Point_2 |
algorithm: calculates voronoi diagram of a point-set input: point-set, scan; output: heterogeneous geometric centers (centroid, circumcenter) or directions (weighted normal)
Voronoi::Voronoi | ( | ) | [inline] |
default constructor
Voronoi::~Voronoi | ( | ) | [inline] |
destructor
void Voronoi::insert | ( | Position | p | ) |
adds a point to the voronoi diagram
[in] | p | position of the point to add |
bool Voronoi::valid | ( | ) |
valid if voronoi diagram has 2 or more regions
check if the scan needs to be filled
[in] | scan | |
[in] | angRangeMin | min range |
[in] | angRangeMax | max range |
[in] | angRes | angular resolution |
fills the scan with the max range when passing from 240° to 360°
[in] | scan | |
[in] | linRangeMax | max range |
[in] | angRes | angular resolution |
vector< Position > Voronoi::intersectScan | ( | Scan & | scan, | |
Position | p, | |||
Decimal | limitedRange, | |||
bool | limitedRangeOn = true , |
|||
bool | useSectors = true | |||
) |
find the intersection between: the scan, the voronoi region, a disk
[in] | scan | |
[in] | p | position of a point inside the voronoi region to intersect |
[in] | limitedRange | radius of the disk to intersect |
[in] | limitedRangeOn | enables or disables intersection with the limitedRange disk |
[in] | useSectors | enables or disables edge sectors optimization |
Position Voronoi::centroid | ( | ) |
find centroid
Position Voronoi::weightedNormal | ( | Decimal | limitedRange, | |
Decimal | limitedRangeEps, | |||
Angle | angRes, | |||
bool | limitTarget = true | |||
) |
compute a point on the direction where the robot can increase the area of its voronoi region
[in] | limitedRange | radius of the disk used for the intersection with the scan (ref. intersectScan) |
[in] | limitedRangeEps | resolution |
[in] | angRes | angular resolution |
[in] | limitTarget | target limited to be inside the disk? |
compute the circumcenter
[out] | radius | of circumference |
void Voronoi::clear | ( | ) |
clear the voronoi diagram
void Voronoi::setGV | ( | CGAL::Geomview_stream * | gvs | ) |
set the pointer to the Geomview stream
[in] | CGAL::Geomview_stream* | pointer to GV stream |
void Voronoi::setDW | ( | DraWin * | dwp, | |
unsigned int | dwpList | |||
) |
set the pointer to the DraWin source
[in] | DraWin* | pointer to DW |
[in] | dwpList | draWin list |
void Voronoi::setDWPose | ( | Pose | dwpPose | ) |
set orientation and position (pose) needed for rototranslation in draWin
[in] | dwpPose | pose of the robot |
void Voronoi::setDWPointSize | ( | Decimal | s | ) |
set the size of points
[in] | s | size of points |
void Voronoi::setDWDiskSize | ( | Decimal | s | ) |
set the size of disk
[in] | s | size of disk |
void Voronoi::setDWColor | ( | Color | c | ) |
set the color
[in] | c | color |
void Voronoi::drawDiagram | ( | ) |
draw the voronoi diagram
void Voronoi::drawSites | ( | ) |
draw sites of the voronoi diagram
void Voronoi::drawDisk | ( | Position | p | ) |
draw disk
[in] | p | position |
draw a segment
[in] | source | segment start point |
[in] | target | segment end point |
draw circle
[in] | center | of circumference |
[in] | radius | of circumference |
[in] | sampling | coefficient |
void Voronoi::drawScan | ( | int | sampling = 1 |
) |
draw scan
[in] | sampling | coefficient |
void Voronoi::drawLimitedScan | ( | int | sampling = 1 |
) |
draw limited scan
[in] | sampling | coefficient |
void Voronoi::drawVoronoiScan | ( | int | sampling = 1 |
) |
draw voronoi scan
[in] | sampling | coefficient |
void Voronoi::drawVoronoiScanPoints | ( | int | sampling = 1 |
) |
draw voronoi scan points
[in] | sampling | coefficient |
void Voronoi::drawRegionEdges | ( | Position | p | ) |
draw region edges
[in] | p | position |
draw region edge sectors
[in] | center | of region |
[in] | radius | of the sectors |
[in] | sampling | coefficient |
bool Voronoi::clearPlot | ( | ) |
clear the plot