Eine Polygonklasse.
More...
#include <polygon.h>
|
|
int32 | vertexCount |
| | Specifies the number of Vertecies in the Vertecies array.
|
| |
|
Vertex * | vertices |
| | COntains the Vertecies of the polygon.
|
| |
◆ Polygon() [1/4]
| Sword25::Polygon::Polygon |
( |
| ) |
|
Creates an object of type #BS_Polygon, containing 0 Vertecies.
With the method Init(), Vertices can be added in later
◆ Polygon() [2/4]
| Sword25::Polygon::Polygon |
( |
const Polygon & |
other | ) |
|
◆ Polygon() [3/4]
Creates a polygon using persisted data
◆ Polygon() [4/4]
| Sword25::Polygon::Polygon |
( |
int |
vertexCount_, |
|
|
const Vertex * |
vertices_ |
|
) |
| |
Creaes an object of type #BS_Polygon, and assigns Vertices to it
- Parameters
-
| VertexCount | The number of vertices being passed |
| Vertecies | An array of BS_Vertex objects representing the vertices in the polygon. |
◆ ~Polygon()
| Sword25::Polygon::~Polygon |
( |
| ) |
|
|
override |
Deletes the BS_Polygon object
◆ init()
| bool Sword25::Polygon::init |
( |
int |
vertexCount_, |
|
|
const Vertex * |
vertices_ |
|
) |
| |
Initializes the BS_Polygon with a list of Vertecies.
The Vertices need to define a polygon must not have self-intersections. If a polygon already has verticies, this will re-initialize it with the new list.
- Parameters
-
| VertexCount | The number of vertices being passed |
| Vertecies | An array of BS_Vertex objects representing the vertices in the polygon. |
- Returns
- Returns false if the Vertecies have self-intersections. In this case, the object is not initialized.
◆ isCW()
| bool Sword25::Polygon::isCW |
( |
| ) |
const |
Checks whether the Vertecies of the polygon are arranged in a clockwise direction.
- Returns
- Returns true if the Vertecies of the polygon are arranged clockwise or co-planar. Returns false if the Vertecies of the polygon are arrange counter-clockwise.
◆ isCCW()
| bool Sword25::Polygon::isCCW |
( |
| ) |
const |
Checks whether the Vertices of the polygon are arranged in a counter-clockwise direction.
- Returns
- Returns true if the Vertecies of the polygon are arranged counter-clockwise. Returns false if the Vertecies of the polygon are arranged clockwise or co-planar.
◆ isPointInPolygon() [1/2]
| bool Sword25::Polygon::isPointInPolygon |
( |
const Vertex & |
vertex, |
|
|
bool |
borderBelongsToPolygon = true |
|
) |
| const |
Checks whether a point is inside the polygon
- Parameters
-
| Vertex | A Vertex with the co-ordinates of the point to be tested. |
| BorderBelongsToPolygon | Specifies whether the edge of the polygon should be considered |
- Returns
- Returns true if the point is inside the polygon, false if it is outside.
◆ isPointInPolygon() [2/2]
| bool Sword25::Polygon::isPointInPolygon |
( |
int |
x, |
|
|
int |
y, |
|
|
bool |
borderBelongsToPolygon = true |
|
) |
| const |
Checks whether a point is inside the polygon
- Parameters
-
| X | The X position of the point |
| Y | The Y position of the point |
| BorderBelongsToPolygon | Specifies whether the edge of the polygon should be considered |
- Returns
- Returns true if the point is inside the polygon, false if it is outside.
◆ getCentroid()
| Vertex Sword25::Polygon::getCentroid |
( |
| ) |
const |
Returns the focus/centroid of the polygon
◆ ensureCWOrder()
| void Sword25::Polygon::ensureCWOrder |
( |
| ) |
|
Ensures that the Vertecies of the polygon are arranged in a clockwise direction
◆ ensureCCWOrder()
| void Sword25::Polygon::ensureCCWOrder |
( |
| ) |
|
Ensures that the Vertecies of the polygon are arranged in a counter-clockwise direction
◆ reverseVertexOrder()
| void Sword25::Polygon::reverseVertexOrder |
( |
| ) |
|
Reverses the Vertecies order.
◆ operator+=()
| void Sword25::Polygon::operator+= |
( |
const Vertex & |
delta | ) |
|
Moves the polygon.
- Parameters
-
| Delta | The vertex around the polygon to be moved. |
The documentation for this class was generated from the following file: