Feature/more constexpr (#125)

* added constexpr

* fix

* improved stuff

* added const

* improvement

* fix

* fix

* patch
This commit is contained in:
2025-12-24 02:32:14 +03:00
committed by GitHub
parent 897484bea1
commit d935caf1a4
36 changed files with 543 additions and 399 deletions

View File

@@ -19,9 +19,9 @@ namespace
// -----------------------------------------------------------------------------
// Constants & helpers
// -----------------------------------------------------------------------------
constexpr float kTol = 1e-5f;
constexpr float k_tol = 1e-5f;
bool VecEqual(const Vec3& a, const Vec3& b, float tol = kTol)
bool vec_equal(const Vec3& a, const Vec3& b, const float tol = k_tol)
{
return std::fabs(a.x - b.x) < tol &&
std::fabs(a.y - b.y) < tol &&
@@ -58,8 +58,8 @@ namespace
TEST_P(CanTraceLineParam, VariousRays)
{
const auto& p = GetParam();
EXPECT_EQ(LineTracer::can_trace_line(p.ray, triangle), p.expected_clear);
const auto& [ray, expected_clear] = GetParam();
EXPECT_EQ(LineTracer::can_trace_line(ray, triangle), expected_clear);
}
INSTANTIATE_TEST_SUITE_P(
@@ -85,8 +85,8 @@ namespace
constexpr Vec3 expected{0.3f, 0.3f, 0.f};
const Vec3 hit = LineTracer::get_ray_hit_point(ray, triangle);
ASSERT_FALSE(VecEqual(hit, ray.end));
EXPECT_TRUE(VecEqual(hit, expected));
ASSERT_FALSE(vec_equal(hit, ray.end));
EXPECT_TRUE(vec_equal(hit, expected));
}
// -----------------------------------------------------------------------------