VPTissue Reference Manual
|
Functions to manipulate polygons. More...
#include <PolygonUtils.h>
Static Public Member Functions | |
static double | CalculateArea (const QPolygonF &polygon) |
Calculate the area of a polygon. More... | |
static std::list< QPolygonF > | ClipPolygon (const QPolygonF &polygon1, const QPolygonF &polygon2) |
Clip a polygon with another polygon and return the intersecting subpolygons. More... | |
static QPolygonF | Counterclockwise (const QPolygonF &polygon) |
Checks if the order of the polygon's points is clockwise and if so, reverts it, else the original polygon is returned. More... | |
static bool | IsClockwise (const QPolygonF &polygon) |
Checks whether the vertices of a polygon are ordered clockwise or counterclockwise. More... | |
static bool | IsSimplePolygon (const QPolygonF &polygon) |
Checks whether a polygon is simple. More... | |
static QPolygonF | OpenPolygon (const QPolygonF &polygon) |
Opens the polygon, ie. More... | |
static std::list< QPolygonF > | SlicePolygon (const QPolygonF &polygon, QLineF cut) |
Slice an open, simple and valid polygon in multiple polygons with a given line. More... | |
Functions to manipulate polygons.
Definition at line 30 of file PolygonUtils.h.
|
static |
Calculate the area of a polygon.
The polygon should be open, valid and simple.
polygon | The given polygon. |
Definition at line 111 of file PolygonUtils.cpp.
References SimPT_Sim::Container::make_const_circular(), and SimPT_Sim::Container::next().
|
static |
Clip a polygon with another polygon and return the intersecting subpolygons.
The polygons should be open, valid and simple.
polygon1 | The first polygon. |
polygon2 | The second polygon. |
Definition at line 130 of file PolygonUtils.cpp.
References SimPT_Sim::Container::prev().
Referenced by SimPT_Editor::VoronoiTesselation::GetCellPolygons(), and SimPT_Editor::RegularGeneratorDialog::GetGeneratedPolygons().
|
static |
Checks if the order of the polygon's points is clockwise and if so, reverts it, else the original polygon is returned.
Clockwise and counterclockwise order of points is checked for in a standard right-handed coordinate system. The polygon should be simple, valid and open.
polygon | The polygon to make counterclockwise. |
Definition at line 96 of file PolygonUtils.cpp.
Referenced by SimPT_Editor::VoronoiGeneratorDialog::GetGeneratedPolygons(), and SimPT_Editor::RegularGeneratorDialog::GetGeneratedPolygons().
|
static |
Checks whether the vertices of a polygon are ordered clockwise or counterclockwise.
The polygon should be open, valid and simple.
polygon | The given polygon. |
Definition at line 35 of file PolygonUtils.cpp.
References SimPT_Sim::Container::make_const_circular(), and SimPT_Sim::Container::next().
Referenced by SimPT_Editor::EditableMesh::CreateCell(), and SimPT_Editor::EditableMesh::ReplaceCell().
|
static |
Checks whether a polygon is simple.
The polygon should be open and valid.
polygon | The given polygon. |
Definition at line 54 of file PolygonUtils.cpp.
References SimPT_Sim::Container::make_const_circular(), and SimPT_Sim::Container::next().
|
static |
Opens the polygon, ie.
if the last point is equal to the first, a new polygon without the last point is returned, else the original polygon is returned. The polygon should be valid.
polygon | The polygon to open. |
Definition at line 83 of file PolygonUtils.cpp.
Referenced by SimPT_Editor::RegularGeneratorDialog::GetGeneratedPolygons().
|
static |
Slice an open, simple and valid polygon in multiple polygons with a given line.
The endpoints of the line should be located outside the polygon.
If there are no (useful) intersections, the original polygon will be returned.
polygon | The given polygon. |
cut | The given line. |
Definition at line 227 of file PolygonUtils.cpp.
References SimPT_Sim::Container::make_const_circular(), SimPT_Sim::Container::next(), and SimPT_Sim::Container::prev().
Referenced by SimPT_Editor::EditableMesh::CanSplitCell(), SimPT_Editor::TissueSlicer::EndCut(), and SimPT_Editor::EditableMesh::SplitCell().