VisiLibity v1 Source Code 1.0
Public Member Functions | Private Attributes | Friends | List of all members
VisiLibity::Polyline Class Reference

oriented polyline in the plane represented by list of vertices More...

#include <visilibity.hpp>

Public Member Functions

 Polyline ()
 default to empty
 
 Polyline (const std::vector< Point > &vertices_temp)
 construct from vector of vertices
 
 Polyline (const std::string &filename)
 construct from file
 
Point operator[] (unsigned i) const
 raw access More...
 
unsigned size () const
 vertex count
 
double length () const
 Euclidean length of the Polyline.
 
double diameter () const
 Euclidean diameter. More...
 
Bounding_Box bbox () const
 
Pointoperator[] (unsigned i)
 raw access More...
 
void clear ()
 erase all points
 
void push_back (const Point &point_temp)
 add a vertex to the back (end) of the list
 
void pop_back ()
 delete a vertex to the back (end) of the list
 
void set_vertices (const std::vector< Point > &vertices_temp)
 reset the whole list of vertices at once
 
void eliminate_redundant_vertices (double epsilon=0.0)
 eliminates vertices which are (epsilon) - colinear with their respective neighbors More...
 
void reverse ()
 reverse order of vertices
 
void append (const Polyline &polyline)
 append the points from another polyline
 
bool operator== (const VisiLibity::Polyline &other)
 Compare two Polylines.
 

Private Attributes

std::vector< Pointvertices_
 

Friends

class Point
 

Detailed Description

oriented polyline in the plane represented by list of vertices

Member Function Documentation

◆ diameter()

double VisiLibity::Polyline::diameter ( ) const

Euclidean diameter.

Precondition
Polyline has greater than 0 vertices
Returns
the maximum Euclidean distance between all pairs of vertices
Remarks
time complexity O(n^2), where n is the number of vertices representing the Polyline

◆ eliminate_redundant_vertices()

void VisiLibity::Polyline::eliminate_redundant_vertices ( double  epsilon = 0.0)

eliminates vertices which are (epsilon) - colinear with their respective neighbors

Author
Karl J. Obermeyer
Postcondition
the Euclidean distance between each vertex and the line segment connecting its neighbors is at least epsilon
Remarks
time complexity O(n), where n is the number of vertices representing the Polyline.

◆ operator[]() [1/2]

Point & VisiLibity::Polyline::operator[] ( unsigned  i)
inline

raw access

Remarks
for efficiency, no bounds checks; usually trying to access out of bounds causes a bus error

◆ operator[]() [2/2]

Point VisiLibity::Polyline::operator[] ( unsigned  i) const
inline

raw access

Remarks
for efficiency, no bounds checks; usually trying to access out of bounds causes a bus error

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