From 3b27fe17c15965aceb4fc2727f3df315acc94a80 Mon Sep 17 00:00:00 2001 From: IlyaShurupov Date: Wed, 17 Jul 2024 09:38:46 +0300 Subject: [PATCH] Math tunes --- Math/public/Rect.hpp | 8 ++++---- Math/public/Vec.hpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Math/public/Rect.hpp b/Math/public/Rect.hpp index ac4496b..cf796f6 100644 --- a/Math/public/Rect.hpp +++ b/Math/public/Rect.hpp @@ -120,14 +120,14 @@ namespace tp { } // pos - Vec2 p1() { return pos; } + Vec2 p1() const { return pos; } // pos + size - Vec2 p3() { return pos + size; } + Vec2 p3() const { return pos + size; } - Vec2 p2() { return { pos.x, pos.y + size.y }; } + Vec2 p2() const { return { pos.x, pos.y + size.y }; } - Vec2 p4() { return { pos.x + size.x, pos.y }; } + Vec2 p4() const { return { pos.x + size.x, pos.y }; } inline bool isAbove(const Rect& rect) const { return (pos.y + size.y < rect.pos.y); } diff --git a/Math/public/Vec.hpp b/Math/public/Vec.hpp index 7a29349..f331b42 100644 --- a/Math/public/Vec.hpp +++ b/Math/public/Vec.hpp @@ -360,6 +360,8 @@ namespace tp { Vec normal() { return { -y, x }; } [[nodiscard]] alnf length2() const { return (x * x + y * y); } + [[nodiscard]] halnf max() const { return tp::max(x, y); } + [[nodiscard]] halnf min() const { return tp::min(x, y); } [[nodiscard]] alnf length() const { Type const tmp = (Type) (x * x + y * y);