Use love::Vector (8 bytes) instead of love::Vertex (20 bytes) for love.math.triangulate and love.math.isConvex.

This commit is contained in:
Alex Szpakowski
2016-08-24 18:02:27 -03:00
parent acde58d311
commit 677a8d60b8
4 changed files with 32 additions and 35 deletions
+10 -2
View File
@@ -43,6 +43,14 @@ namespace love
namespace math
{
struct Triangle
{
Triangle(const Vector &x, const Vector &y, const Vector &z)
: a(x), b(y), c(z)
{}
Vector a, b, c;
};
class BezierCurve;
class Math : public Module
@@ -87,7 +95,7 @@ public:
* @param polygon Polygon to triangulate. Must not intersect itself.
* @return List of triangles the polygon is composed of.
**/
std::vector<Triangle> triangulate(const std::vector<Vertex> &polygon);
std::vector<Triangle> triangulate(const std::vector<love::Vector> &polygon);
/**
* Checks whether a polygon is convex.
@@ -95,7 +103,7 @@ public:
* @param polygon Polygon to test.
* @return True if the polygon is convex, false otherwise.
**/
bool isConvex(const std::vector<Vertex> &polygon);
bool isConvex(const std::vector<love::Vector> &polygon);
/**
* Converts a value from the sRGB (gamma) colorspace to linear RGB.