renamed method

This commit is contained in:
2024-05-07 02:12:16 +03:00
parent e22b6cb0fd
commit 00f20e62f3
2 changed files with 8 additions and 8 deletions

View File

@@ -47,7 +47,7 @@ namespace uml
Vector3 operator*(const Vector3& v) const; Vector3 operator*(const Vector3& v) const;
Vector3 operator/(float fl) const; Vector3 operator/(float fl) const;
Vector3 operator/(const Vector3& v) const; Vector3 operator/(const Vector3& v) const;
[[nodiscard]] Vector3 Transform(const Vector3& angles, float length) const; [[nodiscard]] static Vector3 CreateVelocity(const Vector3& angles, const float length) ;
[[nodiscard]] float Sum() const; [[nodiscard]] float Sum() const;
[[nodiscard]] float Sum2D() const; [[nodiscard]] float Sum2D() const;
[[nodiscard]] Vector3 ViewAngleTo(const Vector3& other) const; [[nodiscard]] Vector3 ViewAngleTo(const Vector3& other) const;

View File

@@ -178,14 +178,14 @@ namespace uml
return {x / v.x, y / v.y, z / v.z}; return {x / v.x, y / v.y, z / v.z};
} }
Vector3 Vector3::Transform(const Vector3 &angles, const float length) const Vector3 Vector3::CreateVelocity(const Vector3 &angles, const float length)
{ {
Vector3 transformed; return
transformed.x += cosf(angles.y * static_cast<float>(M_PI / 180.f)) * length; {
transformed.y += sinf(angles.y * static_cast<float>(M_PI / 180.f)) * length; std::cos(angles::DegToRad(angles.y)) * length,
transformed.z += tanf(angles.x * static_cast<float>(M_PI / 180.f)) * length; std::sin(angles::DegToRad(angles.y)) * length,
std::tan(angles::DegToRad(angles.x)) * length,
return transformed; };
} }
float Vector3::Sum() const float Vector3::Sum() const