refactor: removed wrong library calls for math functions from Vector2D

This commit is contained in:
Syntriax 2025-03-17 21:03:53 +03:00
parent 7743ccadbf
commit e73c076243

View File

@ -77,7 +77,7 @@ public readonly struct Vector2D(float x, float y)
/// </summary> /// </summary>
/// <param name="vector">The <see cref="Vector2D"/>.</param> /// <param name="vector">The <see cref="Vector2D"/>.</param>
/// <returns>The length of the <see cref="Vector2D"/>.</returns> /// <returns>The length of the <see cref="Vector2D"/>.</returns>
public static float Length(Vector2D vector) => MathF.Sqrt(LengthSquared(vector)); public static float Length(Vector2D vector) => Math.Sqrt(LengthSquared(vector));
/// <summary> /// <summary>
/// Calculates the squared length of the <see cref="Vector2D"/>. /// Calculates the squared length of the <see cref="Vector2D"/>.
@ -184,7 +184,7 @@ public readonly struct Vector2D(float x, float y)
/// <param name="vector">The <see cref="Vector2D"/> to rotate.</param> /// <param name="vector">The <see cref="Vector2D"/> to rotate.</param>
/// <param name="angleInRadian">The angle to rotate by, in radians.</param> /// <param name="angleInRadian">The angle to rotate by, in radians.</param>
/// <returns>The rotated <see cref="Vector2D"/>.</returns> /// <returns>The rotated <see cref="Vector2D"/>.</returns>
public static Vector2D Rotate(Vector2D vector, float angleInRadian) => new(MathF.Cos(angleInRadian) * vector.X - MathF.Sin(angleInRadian) * vector.Y, MathF.Sin(angleInRadian) * vector.X + MathF.Cos(angleInRadian) * vector.Y); public static Vector2D Rotate(Vector2D vector, float angleInRadian) => new(Math.Cos(angleInRadian) * vector.X - Math.Sin(angleInRadian) * vector.Y, Math.Sin(angleInRadian) * vector.X + Math.Cos(angleInRadian) * vector.Y);
/// <summary> /// <summary>
/// Returns the component-wise minimum of two <see cref="Vector2D"/>s. /// Returns the component-wise minimum of two <see cref="Vector2D"/>s.
@ -234,7 +234,7 @@ public readonly struct Vector2D(float x, float y)
/// <param name="left">The first <see cref="Vector2D"/>.</param> /// <param name="left">The first <see cref="Vector2D"/>.</param>
/// <param name="right">The second <see cref="Vector2D"/>.</param> /// <param name="right">The second <see cref="Vector2D"/>.</param>
/// <returns>The angle between the two <see cref="Vector2D"/>s in radians.</returns> /// <returns>The angle between the two <see cref="Vector2D"/>s in radians.</returns>
public static float Angle(Vector2D left, Vector2D right) => MathF.Acos(Dot(left, right) / (Length(left) * Length(right))); public static float Angle(Vector2D left, Vector2D right) => Math.Acos(Dot(left, right) / (Length(left) * Length(right)));
/// <summary> /// <summary>
/// Calculates the dot product of two <see cref="Vector2D"/>s. /// Calculates the dot product of two <see cref="Vector2D"/>s.