Improve math module (#396)
* Improve math module - Mark almost everything constexpr - Equality (a == b) is now exact, down to the bit level. If you want approximate equality use the new ApproxEqual method/static method - Rename Nz::Extend to Nz::Extent - Removed Make[] and Set[] methods in favor of their static counterpart and operator=
This commit is contained in:
@@ -27,8 +27,8 @@ SCENARIO("Vector3", "[MATH][VECTOR3]")
|
||||
{
|
||||
REQUIRE(firstUnit.AbsDotProduct(tmp) == Catch::Approx(2.f));
|
||||
REQUIRE(firstUnit.DotProduct(tmp) == Catch::Approx(0.f));
|
||||
REQUIRE(firstUnit.AngleBetween(tmp) == Nz::DegreeAnglef(90.f));
|
||||
REQUIRE(firstUnit.AngleBetween(-firstUnit) == Nz::DegreeAnglef(180.f));
|
||||
REQUIRE(firstUnit.AngleBetween(tmp).ApproxEqual(Nz::DegreeAnglef(90.f)));
|
||||
REQUIRE(firstUnit.AngleBetween(-firstUnit).ApproxEqual(Nz::DegreeAnglef(180.f)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ SCENARIO("Vector3", "[MATH][VECTOR3]")
|
||||
THEN("For normal cases should be normal")
|
||||
{
|
||||
Nz::Vector3f normalized = firstUnit.GetNormal(&ratio);
|
||||
REQUIRE(normalized == (Nz::Vector3f::Unit() / std::sqrt(3.f)));
|
||||
REQUIRE(normalized.ApproxEqual(Nz::Vector3f::Unit() / std::sqrt(3.f)));
|
||||
REQUIRE(ratio == Catch::Approx(std::sqrt(3.f)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user