VisiLibity v1 Source Code 1.0
|
environment represented by simple polygonal outer boundary with simple polygonal holes More...
#include <visilibity.hpp>
Classes | |
class | Shortest_Path_Node |
Public Member Functions | |
Environment () | |
default to empty | |
Environment (const Polygon &polygon_temp) | |
construct Environment without holes More... | |
Environment (const std::vector< Polygon > &polygons) | |
construct Environment with holes from STL vector of Polygons More... | |
Environment (const std::string &filename) | |
const Polygon & | operator[] (unsigned i) const |
raw access to Polygons More... | |
const Point & | operator() (unsigned k) const |
raw access to vertices via flattened index More... | |
unsigned | h () const |
hole count | |
unsigned | n () const |
vertex count More... | |
unsigned | r () const |
total reflex vertex count (nonconvex vertices) More... | |
bool | is_in_standard_form () const |
true iff lexicographically smallest vertex is first in each list of vertices representing a Polygon of the Environment More... | |
bool | is_valid (double epsilon=0.0) const |
true iff epsilon -valid More... | |
double | boundary_length () const |
sum of perimeter lengths of outer boundary and holes More... | |
double | area () const |
(obstacle/hole free) area of the Environment More... | |
double | diameter () const |
Euclidean diameter. More... | |
Bounding_Box | bbox () const |
box which fits snugly around the Environment More... | |
std::vector< Point > | random_points (const unsigned &count, double epsilon=0.0) const |
get STL vector of count Points randomly situated within epsilon of the Environment More... | |
Polyline | shortest_path (const Point &start, const Point &finish, const Visibility_Graph &visibility_graph, double epsilon=0.0) |
compute a shortest path between 2 Points More... | |
Polyline | shortest_path (const Point &start, const Point &finish, double epsilon=0.0) |
compute shortest path between 2 Points More... | |
std::vector< Polygon > | compute_partition_cells (std::vector< Line_Segment > partition_inducing_segments, double epsilon=0.0) |
compute the faces (partition cells) of an arrangement of Line_Segments inside the Environment More... | |
void | write_to_file (const std::string &filename, int fios_precision_temp=FIOS_PRECISION) |
write lists of vertices to *.environment file More... | |
Polygon & | operator[] (unsigned i) |
raw access to Polygons More... | |
Point & | operator() (unsigned k) |
raw access to vertices via flattened index More... | |
void | set_outer_boundary (const Polygon &polygon_temp) |
set outer boundary | |
void | add_hole (const Polygon &polygon_temp) |
add hole | |
void | enforce_standard_form () |
enforces outer boundary vertices are listed ccw and holes listed cw, and that these lists begin with respective lexicographically smallest vertex More... | |
void | eliminate_redundant_vertices (double epsilon=0.0) |
eliminates vertices which are (epsilon) - colinear with their respective neighbors More... | |
void | reverse_holes () |
reverse (cyclic) order of vertices belonging to holes only More... | |
Private Member Functions | |
void | update_flattened_index_key () |
std::pair< unsigned, unsigned > | one_to_two (unsigned k) const |
Private Attributes | |
Polygon | outer_boundary_ |
std::vector< Polygon > | holes_ |
std::vector< std::pair< unsigned, unsigned > > | flattened_index_key_ |
Friends | |
class | Point |
environment represented by simple polygonal outer boundary with simple polygonal holes
|
inline |
construct Environment without holes
VisiLibity::Environment::Environment | ( | const std::vector< Polygon > & | polygons | ) |
construct Environment with holes from STL vector of Polygons
the first Polygon in the vector becomes the outer boundary, the rest become the holes
VisiLibity::Environment::Environment | ( | const std::string & | filename | ) |
construct from *.environment file.
double VisiLibity::Environment::area | ( | ) | const |
(obstacle/hole free) area of the Environment
|
inline |
box which fits snugly around the Environment
double VisiLibity::Environment::boundary_length | ( | ) | const |
sum of perimeter lengths of outer boundary and holes
|
inline |
compute the faces (partition cells) of an arrangement of Line_Segments inside the Environment
|
inline |
Euclidean diameter.
void VisiLibity::Environment::eliminate_redundant_vertices | ( | double | epsilon = 0.0 | ) |
eliminates vertices which are (epsilon) - colinear with their respective neighbors
void VisiLibity::Environment::enforce_standard_form | ( | ) |
enforces outer boundary vertices are listed ccw and holes listed cw, and that these lists begin with respective lexicographically smallest vertex
bool VisiLibity::Environment::is_in_standard_form | ( | ) | const |
true iff lexicographically smallest vertex is first in each list of vertices representing a Polygon of the Environment
bool VisiLibity::Environment::is_valid | ( | double | epsilon = 0.0 | ) | const |
true iff epsilon -valid
epsilon -valid means (i) the outer boundary and holes are pairwise epsilon -disjoint (no two features should come within epsilon of each other) simple polygons, (ii) outer boundary is oriented ccw, and (iii) holes are oriented cw.
unsigned VisiLibity::Environment::n | ( | ) | const |
vertex count
Point & VisiLibity::Environment::operator() | ( | unsigned | k | ) |
raw access to vertices via flattened index
By flattened index is intended the label given to a vertex if you were to label all the vertices from 0 to n-1 (where n is the number of vertices representing the Environment) starting with the first vertex of the outer boundary and progressing in order through all the remaining vertices of the outer boundary and holes.
const Point & VisiLibity::Environment::operator() | ( | unsigned | k | ) | const |
raw access to vertices via flattened index
By flattened index is intended the label given to a vertex if you were to label all the vertices from 0 to n-1 (where n is the number of vertices representing the Environment) starting with the first vertex of the outer boundary and progressing in order through all the remaining vertices of the outer boundary and holes.
|
inline |
raw access to Polygons
An argument of 0 accesses the outer boundary, 1 and above access the holes.
|
inline |
raw access to Polygons
An argument of 0 accesses the outer boundary, 1 and above access the holes.
unsigned VisiLibity::Environment::r | ( | ) | const |
total reflex vertex count (nonconvex vertices)
std::vector< Point > VisiLibity::Environment::random_points | ( | const unsigned & | count, |
double | epsilon = 0.0 |
||
) | const |
get STL vector of count Points randomly situated within epsilon of the Environment
void VisiLibity::Environment::reverse_holes | ( | ) |
reverse (cyclic) order of vertices belonging to holes only
Polyline VisiLibity::Environment::shortest_path | ( | const Point & | start, |
const Point & | finish, | ||
const Visibility_Graph & | visibility_graph, | ||
double | epsilon = 0.0 |
||
) |
compute a shortest path between 2 Points
Uses the classical visibility graph method as described, e.g., in ``Robot Motion Planning" (Ch. 4 Sec. 1) by J.C. Latombe. Specifically, an A* search is performed on the visibility graph using the Euclidean distance as the heuristic function.
Polyline VisiLibity::Environment::shortest_path | ( | const Point & | start, |
const Point & | finish, | ||
double | epsilon = 0.0 |
||
) |
compute shortest path between 2 Points
void VisiLibity::Environment::write_to_file | ( | const std::string & | filename, |
int | fios_precision_temp = FIOS_PRECISION |
||
) |
write lists of vertices to *.environment file
uses intuitive human and computer readable decimal format with display precision fios_precision_temp