Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::Polygon< VectorType >::Ring Class Reference

#include <StkPolygon.h>

Public Member Functions

NodeIter begin () const
 
const VectorType & getNode (int i) const
 
VectorType & getNode (int i)
 
void setNode (int i, const VectorType &n)
 
NodeIter end () const
 
void append (const VectorType &p)
 
const std::vector< VectorType > & nodes () const
 
std::vector< VectorType > & nodes ()
 
int size () const
 
bool empty () const
 
double calcArea () const
 
Ring calcConvHull () const
 Calculate the convex hull of this ring.
 
void removeDuplicates (double eps=1e-6)
 
void reverse ()
 
double calcShortestDistance (const VectorType &p) const
 Calculate the shortest distance from the point p to the ring.
 
bool isInside (const Ring &r)
 Check if ring is inside another ring.
 

Detailed Description

template<class VectorType>
class STK::Polygon< VectorType >::Ring

Ring - Polygon ring. Each polygon consists of one or more rings. Usually these are ordered so that a counterclockwise ring represents a filled polygon (positive area), while a clockwise ring is a hole (negative area).

Member Function Documentation

◆ calcArea()

template<class VectorType >
double STK::Polygon< VectorType >::Ring::calcArea ( ) const
inline

Calculate 2D area. Area is defined by

\[
    A = \sum_{i=0}^{k-1} (x_i y_{i+1} - x_{i+1} y_i)
\]

Where $k$ is number of nodes in the ring and $(x_i, y_i)$ is node $i$ in the ring.

Positive area indicates counter-clockwise winding, and negative means clockwise.

Warning
Only works for simple (non self-intersecting rings).

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