diff --git a/Engine/src/Runtime/Core/public/Math/Vector3.hpp b/Engine/src/Runtime/Core/public/Math/Vector3.hpp index 46c0cad..b50d64b 100644 --- a/Engine/src/Runtime/Core/public/Math/Vector3.hpp +++ b/Engine/src/Runtime/Core/public/Math/Vector3.hpp @@ -1,8 +1,5 @@ #pragma once - -// TODO: BoundToCube -// TODO: ClampToCube // TODO: Slerp (using Quaternions) @@ -867,17 +864,6 @@ namespace Phanes::Core::Math { return v1; } - /** - * Binds vector into cube. - * - * @param(v1) Vector to clamp - * @param(cubeRadius) Radius of the cube - * - * @note result is stored in v1. - */ - - template - TVector3 BoundToCubeV(TVector3 v1, T cubeRadius) {}; /** * Clamps vector into cube. @@ -889,7 +875,14 @@ namespace Phanes::Core::Math { */ template - TVector3 ClampToCubeV(TVector3 v1, T cubeRadius) {}; + TVector3 ClampToCubeV(TVector3 v1, T cubeRadius) + { + v1.x = Clamp(v1.x, -cubeRadius, cubeRadius); + v1.y = Clamp(v1.y, -cubeRadius, cubeRadius); + v1.z = Clamp(v1.z, -cubeRadius, cubeRadius); + + return v1; + }; /** * Reflect by plane @@ -1301,18 +1294,6 @@ namespace Phanes::Core::Math { return unitVec * magnitude; } - /** - * Binds vector into cube. - * - * @param(v1) Vector to clamp - * @param(cubeRadius) Radius of the cube - * - * @result Vector clamped in cube. - */ - - template - TVector3 BoundToCube(const TVector3& v1, T cubeRadius) {}; - /** * Clamps vector into cube. * @@ -1323,7 +1304,14 @@ namespace Phanes::Core::Math { */ template - TVector3 ClampToCube(const TVector3& v1, T cubeRadius) {}; + TVector3 ClampToCube(const TVector3& v1, T cubeRadius) + { + return TVector3( + Clamp(v1.x, -cubeRadius, cubeRadius), + Clamp(v1.y, -cubeRadius, cubeRadius), + Clamp(v1.z, -cubeRadius, cubeRadius), + ); + }; /** * Scales vector two specific magnitude.