Minor fixes

This commit is contained in:
SirLynix
2023-07-30 19:46:01 +02:00
parent a7eba496fb
commit e2808192aa
12 changed files with 22 additions and 28 deletions

View File

@@ -208,7 +208,7 @@ SCENARIO("Matrix4", "[MATH][MATRIX4]")
THEN("We should retrieve it")
{
CHECK(identity.GetScale() == scale);
CHECK(identity.GetScale().ApproxEqual(scale));
CHECK(identity.GetSquaredScale() == squaredScale);
}

View File

@@ -68,7 +68,7 @@ SCENARIO("Plane", "[MATH][PLANE]")
THEN("It must be equal to XZ distance 1")
{
REQUIRE(xy == Nz::Planef(Nz::Vector3f::UnitY(), -1.f));
REQUIRE(xy.ApproxEqual(Nz::Planef(Nz::Vector3f::UnitY(), -1.f)));
}
}
@@ -77,7 +77,7 @@ SCENARIO("Plane", "[MATH][PLANE]")
Nz::Planef xy(Nz::Vector3f(0.f, 1.f, 0.f), Nz::Vector3f(1.f, 1.f, 1.f), Nz::Vector3f(-1.f, 1.f, 0.f));
THEN("It must be equal to XZ distance 1")
{
REQUIRE(xy == Nz::Planef(-Nz::Vector3f::UnitY(), 1.f));
REQUIRE(xy.ApproxEqual(Nz::Planef(-Nz::Vector3f::UnitY(), 1.f)));
}
}
}

View File

@@ -14,7 +14,7 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]")
THEN("They are the same and the proprieties of quaternions are respected")
{
REQUIRE(firstQuaternion.ApproxEqual(secondQuaternion));
REQUIRE(firstQuaternion.ComputeW() == secondQuaternion.Normalize());
REQUIRE(firstQuaternion.ComputeW().ApproxEqual(secondQuaternion.Normalize()));
REQUIRE(firstQuaternion.Conjugate() == secondQuaternion.Inverse());
REQUIRE(firstQuaternion.DotProduct(secondQuaternion) == Catch::Approx(1.f));
}
@@ -200,7 +200,7 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]")
Nz::Vector3f origin(1.f, 0.f, 1.f);
Nz::Vector3f extremity(-1.f, 0.f, 1.f);
Nz::Quaternionf rotation = Nz::Quaternionf::RotationBetween(origin, extremity);
REQUIRE((rotation * origin).ApproxEqual(extremity));
REQUIRE((rotation * origin).ApproxEqual(extremity, 0.0001f));
}
}
}

View File

@@ -75,7 +75,7 @@ SCENARIO("Ray", "[MATH][RAY]")
Nz::BoundingVolumef infiniteVolume(Nz::Extent::Infinite);
CHECK(ray.Intersect(infiniteVolume, &tmpClosest, &tmpFurthest));
CHECK(tmpClosest == Catch::Approx(0.f));
CHECK(tmpFurthest == std::numeric_limits<float>::infinity());
CHECK(std::isinf(tmpFurthest));
}
THEN("For the triangle collision's")

View File

@@ -56,7 +56,7 @@ SCENARIO("Vector2", "[MATH][VECTOR2]")
THEN("For normal cases should be normal")
{
Nz::Vector2f normalized = firstUnit.GetNormal(&ratio);
REQUIRE(normalized == (Nz::Vector2f::Unit() / std::sqrt(2.f)));
REQUIRE(normalized.ApproxEqual(Nz::Vector2f::Unit() / std::sqrt(2.f)));
REQUIRE(ratio == Catch::Approx(std::sqrt(2.f)));
}

View File

@@ -28,7 +28,7 @@ SCENARIO("Vector3", "[MATH][VECTOR3]")
REQUIRE(firstUnit.AbsDotProduct(tmp) == Catch::Approx(2.f));
REQUIRE(firstUnit.DotProduct(tmp) == Catch::Approx(0.f));
REQUIRE(firstUnit.AngleBetween(tmp).ApproxEqual(Nz::DegreeAnglef(90.f)));
REQUIRE(firstUnit.AngleBetween(-firstUnit).ApproxEqual(Nz::DegreeAnglef(180.f)));
REQUIRE(firstUnit.AngleBetween(-firstUnit).ApproxEqual(Nz::DegreeAnglef(180.f), 0.001f));
}
}