first commit of some basics

This commit is contained in:
2026-01-17 09:13:59 +01:00
parent f9bc556ad9
commit c770c62400
41 changed files with 13610 additions and 0 deletions

56
TSE_Math/src/Rect.cpp Normal file
View File

@@ -0,0 +1,56 @@
#include "Rect.hpp"
TSE::Rect::Rect()
{
p1 = {0,0};
p2 = {0,0};
}
TSE::Rect::Rect(float x1, float y1, float x2, float y2)
{
p1 = {x1, y1};
p2 = {x2, y2};
}
TSE::Rect::Rect(const Vector2 &_p1, const Vector2 &_p2)
{
p1 = Vector2(_p1);
p2 = Vector2(_p2);
}
TSE::Rect::Rect(const Vector4 &v)
{
p1 = {v.x, v.y};
p1 = {v.z, v.w};
}
TSE::Rect::Rect(const Rect &r)
{
p1 = Vector2(r.p1);
p2 = Vector2(r.p2);
}
float TSE::Rect::width() const
{
return std::abs(p2.x - p1.x);
}
float TSE::Rect::height() const
{
return std::abs(p2.y - p1.y);
}
float TSE::Rect::area() const
{
return width() * height();
}
bool TSE::Rect::operator==(const Rect &other) const
{
return p1 == other.p1 && p2 == other.p2;
}
bool TSE::Rect::operator!=(const Rect &other) const
{
return !(*this == other);
}