![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Represents a polygon. Usually used for collisions masks. More...
#include <Polygon2d.h>
Public Member Functions | |
std::vector< gd::Vector2f > & | GetVertices () |
Get the vertices composing the polygon. | |
const std::vector< gd::Vector2f > & | GetVertices () const |
Get the vertices composing the polygon. | |
void | Move (double x, double y) |
Moves each vertices from the given amount. More... | |
void | Rotate (double angle) |
Rotate the polygon. More... | |
void | ComputeEdges () const |
Automatically fill edges vector using vertices. | |
bool | IsConvex () const |
Check if the polygon is convex. More... | |
gd::Vector2f | ComputeCenter () const |
Return the position of the center of the polygon. | |
Static Public Member Functions | |
Tools | |
Tool functions | |
static Polygon2d | CreateRectangle (double width, double height) |
Create a rectangle. | |
Public Attributes | |
std::vector< gd::Vector2f > | vertices |
The vertices composing the polygon. | |
std::vector< gd::Vector2f > | edges |
Edges. Can be computed from vertices using ComputeEdges() | |
Represents a polygon. Usually used for collisions masks.
This class stores the vertices of the polygon. It can also compute and store the edges ( needed by some collisions algorithms ) if ComputeEdges is called.
bool Polygon2d::IsConvex | ( | ) | const |
Check if the polygon is convex.
void Polygon2d::Move | ( | double | x, |
double | y | ||
) |
Moves each vertices from the given amount.
void Polygon2d::Rotate | ( | double | angle | ) |
Rotate the polygon.
angle | Angle in radians |