[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

details Polygon< POINT > Class Template Reference VIGRA

#include <vigra/polygon.hxx>

Inheritance diagram for Polygon< POINT >:
ArrayVector< TinyVector< double, 2 > > ArrayVectorView< T >

Public Member Functions

double arcLengthQuantile (double quantile) const
 
bool closed () const
 Returns true iff the last and first points are equal or the polygon is empty.
 
bool contains (const_reference point, coordinate_type tolerance) const
 
Point interpolate (unsigned int index, double offset) const
 

Detailed Description

template<class POINT = TinyVector<double, 2>>
class vigra::Polygon< POINT >

Polygons in two and higher dimenions.

Member Function Documentation

◆ interpolate()

Point interpolate ( unsigned int  index,
double  offset 
) const

Linearly interpolate at offset between knots index and index+1.

Preconditions: 0 <= index < size()-1 and 0 <= offset <= 1.

◆ contains()

bool contains ( const_reference  point,
coordinate_type  tolerance 
) const

Tests whether the given point lies within this polygon. Requires that this polygon is closed.

Points which lie directly on the polylines or coincide with a knot are considered inside (this behavior is consistent with fillPolygon()). Parameter tolerance (interpreted as an absolute error bound) controls the numerical accuracy of this test.

◆ arcLengthQuantile()

double arcLengthQuantile ( double  quantile) const

Find the point on the polygon that corresponds to the given quantile.

quantile must be in [0.0, 1.0]. The result of this function can be used as input to interpolate(). For example, the following code computes the point in the middle of the polygon:

double c = poly.arcLengthQuantile(0.5);
Point center = poly.interpolate((int)floor(c), c - floor(c));
int floor(FixedPoint< IntBits, FracBits > v)
rounding down.
Definition: fixedpoint.hxx:667

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

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1