From 4827f80257d6e77cffbf1f566b2887630d01b692 Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 7 May 2024 02:12:16 +0300 Subject: [PATCH] added 2 methods --- include/uml/Vector3.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uml/Vector3.h b/include/uml/Vector3.h index 4b6cc09..1b7130f 100644 --- a/include/uml/Vector3.h +++ b/include/uml/Vector3.h @@ -47,7 +47,18 @@ namespace uml Vector3 operator*(const Vector3& v) const; Vector3 operator/(float fl) const; Vector3 operator/(const Vector3& v) const; - [[nodiscard]] static Vector3 CreateVelocity(const Vector3& angles, const float length) ; + + template + const type& As() const + { + return *reinterpret_cast(this); + } + template + type& As() + { + return *reinterpret_cast(this); + } + [[nodiscard]] static Vector3 CreateVelocity(const Vector3& angles, const float length); [[nodiscard]] float Sum() const; [[nodiscard]] float Sum2D() const; [[nodiscard]] Vector3 ViewAngleTo(const Vector3& other) const;