Implementing Vector3 Unit Tests

This commit is contained in:
2024-01-02 16:29:19 -05:00
parent 0620c8aea5
commit 09922ac0bd
7 changed files with 298 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ namespace LinearAlgebra {
// Constructs a new Vector2 with the value (X, Y)
Vector2(float X, float Y);
Vector2(const Vector2& rhs); // Copy Constructor
Vector2(Vector2&&) = default; // Move Constructor
//Vector2(Vector2&&) = default; // Move Constructor
static const Vector2 Zero;
static const Vector2 Up;
@@ -80,7 +80,7 @@ namespace LinearAlgebra {
Vector2 Lerp(const Vector2& rhs, float alpha) const;
// @see Lerp
static Vector2 Lerp(const Vector2& lhs, const Vector2& rhs, float alpha);
// Note: Input vectors MUST be normalized first!
float AngleBetween(const Vector2& rhs) const;
static float AngleBetween(const Vector2& lhs, const Vector2& rhs);
@@ -104,12 +104,11 @@ namespace LinearAlgebra {
Vector2 Div(float scalar) const;
static Vector2 Div(const Vector2& lhs, float rhs);
// Unary operator +
Vector2 operator +() const; // TODO: Implement
Vector2 operator -() const;
// Assigns a vector to another
Vector2& operator=(const Vector2&v);
Vector2& operator+=(const Vector2& rhs); // Adds a vector to this vector, in-place.

View File

@@ -36,8 +36,6 @@ public:
void SetY(float newY);
void SetZ(float newZ);
bool IsWithinMarginOfError(const Vector3& rhs, float margin=0.001f) const;
bool IsNormalized(float epsilonSq = 1e-5f) const;
bool IsZero(float epsilonSq = 1e-6f) const;
@@ -68,10 +66,7 @@ public:
// Returns the length of the vector, which is sqrt(x^2 + y^2 + z^2)
float Magnitude() const;
static float Magnitude(const Vector3& of)
{
}
static float Magnitude(const Vector3& of);
// Returns a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them.
// For normalized vectors, dot returns 1 if they point in exactly the same direction,