Add conversion from Vector2-float to Vector2i
This commit is contained in:
@@ -61,7 +61,6 @@ namespace J3ML::LinearAlgebra {
|
||||
explicit Vector2(const Vector2i& rhs);
|
||||
//Vector2(Vector2&&) = default; // Move Constructor
|
||||
|
||||
|
||||
[[nodiscard]] float GetX() const;
|
||||
[[nodiscard]] float GetY() const;
|
||||
void SetX(float newX);
|
||||
@@ -111,14 +110,10 @@ namespace J3ML::LinearAlgebra {
|
||||
|
||||
/// Tests if two vectors are equal, up to the given epsilon.
|
||||
/** @see IsPerpendicular(). */
|
||||
bool Equals(const Vector2& rhs, float epsilon = 1e-3f) const {
|
||||
return Math::EqualAbs(x, rhs.x, epsilon) &&
|
||||
Math::EqualAbs(y, rhs.y, epsilon);
|
||||
}
|
||||
bool Equals(float x_, float y_, float epsilon = 1e-3f) const {
|
||||
return Math::EqualAbs(x, x_, epsilon) &&
|
||||
Math::EqualAbs(y, y_, epsilon);
|
||||
}
|
||||
bool Equals(const Vector2& rhs, float epsilon = 1e-3f) const;
|
||||
bool Equals(float x_, float y_, float epsilon = 1e-3f) const;
|
||||
|
||||
bool PreciselyEquals(const Vector2& rhs) const;
|
||||
|
||||
bool operator == (const Vector2& rhs) const;
|
||||
bool operator != (const Vector2& rhs) const;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Vector2.hpp"
|
||||
|
||||
namespace J3ML::LinearAlgebra {
|
||||
class Vector2i;
|
||||
@@ -12,6 +13,7 @@ public:
|
||||
Vector2i();
|
||||
Vector2i(int x, int y) : x(x), y(y) {}
|
||||
explicit Vector2i(int rhs) : x(rhs), y(rhs) {}
|
||||
explicit Vector2i(const Vector2& rhs) : x(rhs.x), y(rhs.y) { }
|
||||
public:
|
||||
bool operator == (const Vector2i& rhs) const;
|
||||
bool operator != (const Vector2i& rhs) const;
|
||||
|
Reference in New Issue
Block a user