added 2d png support

This commit is contained in:
h4570
2020-12-01 17:26:10 +01:00
parent 3841487388
commit 510199164c
17 changed files with 317 additions and 80 deletions
+16
View File
@@ -9,6 +9,7 @@
*/
#include "../../include/models/math/point.hpp"
#include "../../include/utils/math.hpp"
#include <stdio.h>
@@ -55,6 +56,21 @@ void Point::set(const Point &v)
y = v.y;
}
void Point::rotate(const float &t_angle, const float &t_x, const float &t_y)
{
float s = Math::sin(t_angle);
float c = Math::cos(t_angle);
x -= t_x;
y -= t_y;
float xnew = x * c - y * s;
float ynew = x * s + y * c;
x = xnew + t_x;
y = ynew + t_y;
}
const void Point::print() const
{
printf("Point(%f, %f)\n", x, y);