STIRA
0.1
|
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. | |
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
void stira::common::Polygon::AddVertex | ( | Point< double > | newVertex | ) |
Adds a vertex to the polygon (inserted at the end)
newVertex | vertex 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.
testPoint | point 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.
nr | index 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.
nr | index 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.
testPoint | point to be tested if it is inside the polygon |
References stira::common::Point< T >::x, and stira::common::Point< T >::y.