VisiLibity v1 Source Code 1.0
|
simple polygon in the plane represented by list of vertices More...
#include <visilibity.hpp>
Public Member Functions | |
Polygon () | |
default to empty | |
Polygon (const std::string &filename) | |
construct from *.polygon file More... | |
Polygon (const std::vector< Point > &vertices_temp) | |
construct from vector of vertices More... | |
Polygon (const Point &point0, const Point &point1, const Point &point2) | |
construct triangle from 3 Points More... | |
const Point & | operator[] (unsigned i) const |
access with automatic wrap-around in forward direction More... | |
unsigned | n () const |
vertex count More... | |
unsigned | r () const |
reflex vertex count (nonconvex vertices) More... | |
bool | is_simple (double epsilon=0.0) const |
true iff Polygon is (epsilon) simple More... | |
bool | is_in_standard_form () const |
true iff lexicographically smallest vertex is first in the list of vertices representing the Polygon More... | |
double | boundary_length () const |
perimeter length | |
double | area () const |
Point | centroid () const |
Polygon's centroid (center of mass) More... | |
double | diameter () const |
Euclidean diameter. More... | |
Bounding_Box | bbox () const |
box which fits snugly around the Polygon More... | |
std::vector< Point > | random_points (const unsigned &count, double epsilon=0.0) const |
void | write_to_file (const std::string &filename, int fios_precision_temp=FIOS_PRECISION) |
write list of vertices to *.polygon file More... | |
Point & | operator[] (unsigned i) |
access with automatic wrap-around in forward direction More... | |
void | set_vertices (const std::vector< Point > &vertices_temp) |
set vertices using STL vector of Points | |
void | push_back (const Point &vertex_temp) |
push a Point onto the back of the vertex list | |
void | clear () |
erase all vertices | |
void | enforce_standard_form () |
enforces that the lexicographically smallest vertex is first in the list of vertices representing the Polygon More... | |
void | eliminate_redundant_vertices (double epsilon=0.0) |
eliminates vertices which are (epsilon) - colinear with their respective neighbors More... | |
void | reverse () |
reverse (cyclic) order of vertices More... | |
Protected Attributes | |
std::vector< Point > | vertices_ |
Friends | |
class | Point |
simple polygon in the plane represented by list of vertices
Simple here means non-self-intersecting. More precisely, edges should not (i) intersect with an edge not adjacent to it, nor (ii) intersect at more than one Point with an adjacent edge.
VisiLibity::Polygon::Polygon | ( | const std::string & | filename | ) |
construct from *.polygon file
VisiLibity::Polygon::Polygon | ( | const std::vector< Point > & | vertices_temp | ) |
construct from vector of vertices
construct triangle from 3 Points
double VisiLibity::Polygon::area | ( | ) | const |
Bounding_Box VisiLibity::Polygon::bbox | ( | ) | const |
Point VisiLibity::Polygon::centroid | ( | ) | const |
double VisiLibity::Polygon::diameter | ( | ) | const |
void VisiLibity::Polygon::eliminate_redundant_vertices | ( | double | epsilon = 0.0 | ) |
eliminates vertices which are (epsilon) - colinear with their respective neighbors
void VisiLibity::Polygon::enforce_standard_form | ( | ) |
enforces that the lexicographically smallest vertex is first in the list of vertices representing the Polygon
bool VisiLibity::Polygon::is_in_standard_form | ( | ) | const |
true iff lexicographically smallest vertex is first in the list of vertices representing the Polygon
bool VisiLibity::Polygon::is_simple | ( | double | epsilon = 0.0 | ) | const |
true iff Polygon is (epsilon) simple
|
inline |
vertex count
|
inline |
access with automatic wrap-around in forward direction
|
inline |
access with automatic wrap-around in forward direction
unsigned VisiLibity::Polygon::r | ( | ) | const |
reflex vertex count (nonconvex vertices)
void VisiLibity::Polygon::reverse | ( | ) |
reverse (cyclic) order of vertices
void VisiLibity::Polygon::write_to_file | ( | const std::string & | filename, |
int | fios_precision_temp = FIOS_PRECISION |
||
) |
write list of vertices to *.polygon file