1
0
forked from josh/j3ml

Implement Vector2Tests

This commit is contained in:
2023-12-29 01:02:57 -05:00
parent fd4cc4723b
commit d2960b1dc4
9 changed files with 242 additions and 178 deletions

View File

@@ -188,5 +188,48 @@ namespace LinearAlgebra {
float Vector3::GetZ() const { return z;}
void Vector3::SetX(float newX) { x = newX;}
void Vector3::SetY(float newY) { y = newY;}
void Vector3::SetZ(float newZ) { z = newZ;}
Vector3 Vector3::Min(const Vector3 &lhs, const Vector3 &rhs) {
return lhs.Min(rhs);
}
Vector3 Vector3::Max(const Vector3 &lhs, const Vector3 &rhs) {
return lhs.Max(rhs);
}
Vector3 Vector3::Clamp(const Vector3 &min, const Vector3 &input, const Vector3 &max) {
return input.Clamp(min, max);
}
float Vector3::Distance(const Vector3 &from, const Vector3 &to) {
return from.Distance(to);
}
float Vector3::Length(const Vector3 &of) {
return of.Length();
}
float Vector3::LengthSquared(const Vector3 &of) {
return of.LengthSquared();
}
bool Vector3::IsPerpendicular(const Vector3 &other, float epsilonSq) const {
float dot = Dot(other);
return dot*dot <= epsilonSq * LengthSquared() * other.LengthSquared();
}
bool Vector3::IsZero(float epsilonSq) const {
return LengthSquared() <= epsilonSq;
}
bool Vector3::IsNormalized(float epsilonSq) const {
return std::abs(LengthSquared()-1.f) <= epsilonSq;
}
#pragma endregion
}