Implement Vector2::Abs() and Vector3::Abs()
This commit is contained in:
@@ -31,6 +31,8 @@ namespace J3ML::LinearAlgebra {
|
|||||||
void SetX(float newX);
|
void SetX(float newX);
|
||||||
void SetY(float newY);
|
void SetY(float newY);
|
||||||
|
|
||||||
|
Vector2 Abs() const;
|
||||||
|
|
||||||
bool IsWithinMarginOfError(const Vector2& rhs, float margin=0.001f) const;
|
bool IsWithinMarginOfError(const Vector2& rhs, float margin=0.001f) const;
|
||||||
|
|
||||||
bool IsNormalized(float epsilonSq = 1e-5f) const;
|
bool IsNormalized(float epsilonSq = 1e-5f) const;
|
||||||
|
@@ -253,4 +253,6 @@ namespace J3ML::LinearAlgebra {
|
|||||||
Vector2 Vector2::Div(const Vector2 &v) const {
|
Vector2 Vector2::Div(const Vector2 &v) const {
|
||||||
return {this->x/v.x, this->y/v.y};
|
return {this->x/v.x, this->y/v.y};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector2 Vector2::Abs() const { return {std::abs(x), std::abs(y)};}
|
||||||
}
|
}
|
Reference in New Issue
Block a user