mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Simplifies raycast early exit condition
Combines the infinite length raycast hit check into a single condition. This clarifies the logic and avoids redundant checks for early exit in the ray-triangle intersection test, improving performance.
This commit is contained in:
@@ -50,12 +50,10 @@ namespace omath::collision
|
||||
|
||||
const auto t_hit = side_b.dot(q) * inv_det;
|
||||
|
||||
if (ray.infinite_length)
|
||||
{
|
||||
if (t_hit <= k_epsilon)
|
||||
return ray.end;
|
||||
}
|
||||
else if (t_hit <= k_epsilon || t_hit > 1.0f - k_epsilon)
|
||||
if (ray.infinite_length && t_hit <= k_epsilon)
|
||||
return ray.end;
|
||||
|
||||
if (t_hit <= k_epsilon || t_hit > 1.0f - k_epsilon)
|
||||
return ray.end;
|
||||
|
||||
return ray.start + ray_dir * t_hit;
|
||||
|
||||
Reference in New Issue
Block a user