Represent polygons in 2D as a list of vertices in counter-clockwise order.
More...
#include <Polygon.hpp>
|
| static constexpr float | MIN_R = 0.0001 |
| |
Represent polygons in 2D as a list of vertices in counter-clockwise order.
◆ Polygon() [1/2]
◆ Polygon() [2/2]
| Polygon::Polygon |
( |
Point |
mid, |
|
|
float |
radius, |
|
|
GLuint |
colorIndex |
|
) |
| |
Create a circle.
- Parameters
-
| mid | Middle point of the circle. |
| radius | Radius of the circle. |
◆ displace()
| void Polygon::displace |
( |
const std::vector< Displacement > & |
displacements, |
|
|
size_t |
canvasSize |
|
) |
| |
Displace a polygon as a result of a new circle appearing. The math for this function was provided by Prof. Graham Horton.
- Parameters
-
| displacements | vector of circles with radius and diameter which causes displacement |
| canvasSize | size of canvas in pixel to calculate vertex insertion for smooth edges. |
◆ getCreationPoint()
| Point const & Polygon::getCreationPoint |
( |
| ) |
|
Return the point which was the original middle point.
- Returns
- middle point
◆ getDrawInfo()
| void Polygon::getDrawInfo |
( |
std::vector< WGLVertex > & |
vertices, |
|
|
GLuint |
z |
|
) |
| const |
Fill vectors with infos needed for drawing. Intended to be used for glDrawElements(). Therefore 3 consecutive indices define one triangle to be drawn and refer to vertices inside the vertices vector.
- Parameters
-
| indices | Vector to be filled with triangle information. |
| vertices | Vector to be filled with vertices. |
- Attention
- Winding order is clockwise so face culling in WGL needs to be disabled. This is no performance limitation as each triangle is allways visible.
◆ getVertCount()
| size_t Polygon::getVertCount |
( |
| ) |
const |
- Returns
- Number of vertices of a polygon.
◆ makeCircle()
| void Polygon::makeCircle |
( |
Point |
mid, |
|
|
float |
radius |
|
) |
| |
Redraw Polygon as a new circle. This is intended to be used for making the circle larger.
- Parameters
-
| mid | Middle point of the circle. |
| radius | Radius of the circle. |
- Attention
- Will throw an error if used on a polygon that is no longer a circle.
◆ MIN_R
| constexpr float Polygon::MIN_R = 0.0001 |
|
staticconstexpr |
The documentation for this class was generated from the following files: