STIRA  0.1
Public Member Functions | List of all members
stira::common::Polygon Class Reference

class that contains a polygon. For us, a polygon is a list of vertices in an stl vector, where the first point equals the last point More...

#include <Polygon.h>

Public Member Functions

 Polygon ()
 constructor
 
void AddVertex (Point< double > newVertex)
 Adds a vertex to the polygon (inserted at the end) More...
 
unsigned int GetNumberOfVertices ()
 Gets the number of vertices in the polygon.
 
Point< double > GetVertex (int nr)
 Gets the vertex with given index with coordinates as doubles. More...
 
Point< int > GetVertexInt (int nr)
 Gets the vertex with given index with coordinates rounded to integers. More...
 
void ChangeVertex (int nr, double x, double y)
 Changes the coordinates of the given vertex. More...
 
bool IsPointInPolygon (Point< int > testPoint)
 Checks if a point is inside a polygon Source http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html. More...
 
double GetPolygonArea ()
 Computes area of a polygon Source http://www.mathopenref.com/coordpolygonarea2.html.
 

Detailed Description

class that contains a polygon. For us, a polygon is a list of vertices in an stl vector, where the first point equals the last point

Member Function Documentation

void stira::common::Polygon::AddVertex ( Point< double >  newVertex)

Adds a vertex to the polygon (inserted at the end)

Parameters
newVertexvertex to be added to the polygon at the end of list of vertices
void stira::common::Polygon::ChangeVertex ( int  nr,
double  x,
double  y 
)

Changes the coordinates of the given vertex.

Parameters
testPointpoint to be tested if it is inside the polygon
Point< double > stira::common::Polygon::GetVertex ( int  nr)

Gets the vertex with given index with coordinates as doubles.

Parameters
nrindex of vertex to get

Referenced by stira::imagetools::DrawImageTools::DrawPolygon().

Point< int > stira::common::Polygon::GetVertexInt ( int  nr)

Gets the vertex with given index with coordinates rounded to integers.

Parameters
nrindex of vertex to get

Referenced by stira::imagetools::DrawImageTools::DrawPolygon().

bool stira::common::Polygon::IsPointInPolygon ( Point< int >  testPoint)

Checks if a point is inside a polygon Source http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html.

Parameters
testPointpoint to be tested if it is inside the polygon

References stira::common::Point< T >::x, and stira::common::Point< T >::y.


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