xc
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
PolyPos< pos > Class Template Reference

Base class for position lists. More...

#include <PolyPos.h>

Inheritance diagram for PolyPos< pos >:
Inheritance graph
[legend]
Collaboration diagram for PolyPos< pos >:
Collaboration graph
[legend]

Public Types

typedef deque_pos::iterator iterator
 
typedef deque_pos::const_iterator const_iterator
 
typedef pos::vector vector
 

Public Member Functions

 PolyPos (const std::deque< pos > &dq_pos)
 
pos getFromPoint (void) const
 
pos getToPoint (void) const
 
bool operator== (const PolyPos< pos > &other) const
 
pos * Agrega (const pos &p)
 
void Agrega (const PolyPos< pos > &p)
 
void AgregaSiNuevo (const PolyPos< pos > &p)
 
template<class InputIterator >
void extend (InputIterator first, InputIterator last)
 Append the vertices between [first,last) to thebefore end of the list. More...
 
void AgregaSiNuevo (const pos &)
 Appends the point to the list (if not already there).
 
const_iterator find (const pos &p) const
 
iterator find (const pos &p)
 
bool In (const pos &p) const
 Return true if the points is on en la lista.
 
void close (void)
 Close the point list (insert the first point as its last one)
 
bool isClosed (const GEOM_FT &tol=1e-6) const
 True if dist(lastPoint,firstPoint)< tol*length.
 
GEOM_FT getLength (void) const
 Return the length of the PolyPos.
 
std::vector< GEOM_FT > getLengths (void) const
 Return the lengths corresponding to each vertex.
 
boost::python::list getLengthsPy (void) const
 Return the lengths corresponding to each vertex in a Python list.
 
GEOM_FT getLengthUntilVertex (const_iterator) const
 Return the length of the PolyPos until the vertex pointed by the iterator. More...
 
const_iterator getSegmentAtLength (const GEOM_FT &s) const
 Return an iterator pointing to the vertex that is just before the point at a distance "s" measured along the polyline from its origin. More...
 
int getIndexOfSegmentAtLength (const GEOM_FT &s) const
 Return the index of the segment that lies at the point at a distance "s" measured along the polyline from its origin. More...
 
int getIndexOfSegmentAtParam (const GEOM_FT &lambda) const
 Return the index of the segment that lies at the point at a distance "lambda*L" measured along the polyline from its origin. More...
 
boost::python::list getIthCoordinates (unsigned short i) const
 Return the list of values for j-th coordinate.
 
GEOM_FT GetMax (unsigned short i) const
 Return the maximum value of j-th coordinate.
 
GEOM_FT GetMin (unsigned short i) const
 Return the minimum value of j-th coordinate.
 
PolyPos GetMayores (unsigned short int i, const GEOM_FT &d) const
 
PolyPos GetMenores (unsigned short int i, const GEOM_FT &d) const
 
pos getCenterOfMass (void) const
 Return the center of mass del polígono.
 
pos getWeightedCenterOfMass (const std::deque< GEOM_FT > &) const
 Return the center of mass del polígono.
 
PolyPos< pos > getSwap (void) const
 Return a list with the elements in reverse order.
 
void swap (void)
 
std::deque< GEOM_FT > & GetSeparaciones (void) const
 Compute the distance from each point to the nearest one.
 
GEOM_FT GetSeparacionMedia (void) const
 Return the average distance between points.
 
iterator getNearestPoint (const pos &)
 Returns the nearest point from those of the list.
 
const_iterator getNearestPoint (const pos &) const
 Returns the nearest point from those of the list.
 
iterator getFarthestPoint (const pos &)
 Returns the farthest point from those of the list.
 
const_iterator getFarthestPoint (const pos &) const
 Returns the farthest point from those of the list.
 
virtual iterator getFarthestPointFromSegment (iterator it1, iterator it2, GEOM_FT &pMaxDist)
 
void simplify (GEOM_FT epsilon, iterator it1, iterator it2)
 Douglas Peucker algorithm implementation. More...
 
void simplify (GEOM_FT epsilon)
 Douglas Peucker algorithm implementation. More...
 
PolyPos< pos > getSimplified (GEOM_FT epsilon) const
 ! More...
 
void removeRepeated (const GEOM_FT &tol=0.0)
 remove repeated vertexes. More...
 
void removeBackwardSegments (const GEOM_FT &tol)
 remove backward segments. More...
 
void Cat (const PolyPos< pos > &l)
 
template<class inputIterator >
void Cat (inputIterator begin, inputIterator end)
 Insert the objects between [first,last).
 

Protected Types

typedef std::deque< pos > deque_pos
 

Protected Member Functions

void simplify_select (GEOM_FT epsilon, iterator it1, iterator it2, std::set< const_iterator > &selected)
 Douglas Peucker algorithm implementation. More...
 
void remove_selected (std::set< const_iterator > &selected)
 Removes the selected items. More...
 
void select_repeated (std::set< const_iterator > &selected, const GEOM_FT &tol=0.0)
 Select repeated vertexes. More...
 
void select_backward_segments (std::set< const_iterator > &selected, const GEOM_FT &tol)
 Select backward segments. More...
 

Static Protected Member Functions

static GEOM_FT g (GEOM_FT v1, GEOM_FT v2)
 

Detailed Description

template<class pos>
class PolyPos< pos >

Base class for position lists.

Member Function Documentation

◆ extend()

template<class pos>
template<class InputIterator >
void PolyPos< pos >::extend ( InputIterator  first,
InputIterator  last 
)
inline

Append the vertices between [first,last) to thebefore end of the list.

◆ getFarthestPointFromSegment()

template<class pos >
PolyPos< pos >::iterator PolyPos< pos >::getFarthestPointFromSegment ( iterator  it1,
iterator  it2,
GEOM_FT &  pMaxDist 
)
virtual
Parameters
i1iterator to the first point.
i2iterator to the second point.
pMaxDistpointer to the maximum distance of _line[return index].
Returns
the index of the point farthest from the segment (t1,t2).

Reimplemented in Polyline2d, and Polyline3d.

◆ getIndexOfSegmentAtLength()

template<class pos >
int PolyPos< pos >::getIndexOfSegmentAtLength ( const GEOM_FT &  s) const

Return the index of the segment that lies at the point at a distance "s" measured along the polyline from its origin.

Parameters
sdistance measured along the polyline from its origin.

◆ getIndexOfSegmentAtParam()

template<class pos >
int PolyPos< pos >::getIndexOfSegmentAtParam ( const GEOM_FT &  lambda) const

Return the index of the segment that lies at the point at a distance "lambda*L" measured along the polyline from its origin.

Parameters
lambdaparameter (0.0->start of the pline, 1.0->end of the pline).

◆ getLengthUntilVertex()

template<class pos >
GEOM_FT PolyPos< pos >::getLengthUntilVertex ( const_iterator  nth) const

Return the length of the PolyPos until the vertex pointed by the iterator.

Parameters
nthiterator pointing to the desired vertex.

◆ getSegmentAtLength()

template<class pos >
PolyPos< pos >::const_iterator PolyPos< pos >::getSegmentAtLength ( const GEOM_FT &  s) const

Return an iterator pointing to the vertex that is just before the point at a distance "s" measured along the polyline from its origin.

Parameters
sdistance measured along the polyline from its origin.

◆ getSimplified()

template<class pos >
PolyPos< pos > PolyPos< pos >::getSimplified ( GEOM_FT  epsilon) const

!

Return simplified point sequence using Douglas Peucker algorithm. Recursively delete points that are within epsilon.

Parameters
epsilonthe higher the more aggressive.

◆ remove_selected()

template<class pos >
void PolyPos< pos >::remove_selected ( std::set< const_iterator > &  selected)
protected

Removes the selected items.

Parameters
selectediterators pointing to the items to be removed.

◆ removeBackwardSegments()

template<class pos >
void PolyPos< pos >::removeBackwardSegments ( const GEOM_FT &  tol)

remove backward segments.

Parameters
tolminimum accepted value for the dot product (<0) of consecutive direction vectors.

◆ removeRepeated()

template<class pos >
void PolyPos< pos >::removeRepeated ( const GEOM_FT &  tol = 0.0)

remove repeated vertexes.

Parameters
tolminimum distance between vertices to be considered equal.

◆ select_backward_segments()

template<class pos >
void PolyPos< pos >::select_backward_segments ( std::set< const_iterator > &  selected,
const GEOM_FT &  tol 
)
protected

Select backward segments.

Parameters
selectedlist containing the vertexes that generate backward segments.
tolminimum accepted value for the dot product (<0) of consecutive direction vectors.

◆ select_repeated()

template<class pos >
void PolyPos< pos >::select_repeated ( std::set< const_iterator > &  selected,
const GEOM_FT &  tol = 0.0 
)
protected

Select repeated vertexes.

Parameters
selectedlist containing the repeated vertexes.
tolminimum distance between vertices to be considered equal.

◆ simplify() [1/2]

template<class pos >
void PolyPos< pos >::simplify ( GEOM_FT  epsilon,
iterator  it1,
iterator  it2 
)

Douglas Peucker algorithm implementation.

Recursively delete points that are within epsilon.

Parameters
epsilonthe higher the more aggressive.
iteratorof the first point in a segment.
iteratorof the last point in a segment.

◆ simplify() [2/2]

template<class pos >
void PolyPos< pos >::simplify ( GEOM_FT  epsilon)

Douglas Peucker algorithm implementation.

Recursively delete points that are within epsilon.

Parameters
epsilonthe higher the more aggressive.
epsilonThe higher, the more points gotten rid of.

◆ simplify_select()

template<class pos >
void PolyPos< pos >::simplify_select ( GEOM_FT  epsilon,
iterator  it1,
iterator  it2,
std::set< const_iterator > &  selected 
)
protected

Douglas Peucker algorithm implementation.

Recursively delete points that are within epsilon.

Parameters
epsilonthe higher the more aggressive.
iteratorof the first point in a segment.
iteratorof the last point in a segment.
selectedlist containing the vertexes to be removed.

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