mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[simd] Check the distance to the affine point
As per usual, fp math finds a way to confound any epsilon test. So rather than relying entirely on test_support_points, check the distance from the sphere center to the affine point and break out of the loop if the distance is small enough (< 1% of the current radius). This allows qfvis to load ad_tears without hacks.
This commit is contained in:
parent
45aa8e6504
commit
6d312aaa63
2 changed files with 14 additions and 2 deletions
|
@ -1443,11 +1443,17 @@ SmallestEnclosingBall (const vec3_t points[], int num_points)
|
|||
|
||||
if (iters++ > 10)
|
||||
Sys_Error ("stuck SEB");
|
||||
best = 0;
|
||||
|
||||
closest_affine_point (support, num_support, sphere.center, affine);
|
||||
VectorSubtract (affine, sphere.center, center_to_affine);
|
||||
affine_dist = DotProduct (center_to_affine, center_to_affine);
|
||||
if (affine_dist < sphere.radius * 1e-5) {
|
||||
// It's possible test_support_points failed due to precision
|
||||
// issues
|
||||
break;
|
||||
}
|
||||
|
||||
best = 0;
|
||||
for (i = 0; i < num_points; i++) {
|
||||
if (points[i] == support[0] || points[i] == support[1]
|
||||
|| points[i] == support[2])
|
||||
|
|
|
@ -288,11 +288,17 @@ SmallestEnclosingBall_vf (const vec4f_t *points, int num_points)
|
|||
|
||||
if (iters++ > 10)
|
||||
Sys_Error ("stuck SEB");
|
||||
best = 0;
|
||||
|
||||
affine = closest_affine_point (support, num_support, center);
|
||||
center_to_affine = affine - center;
|
||||
affine_dist = dotf (center_to_affine, center_to_affine)[0];
|
||||
if (affine_dist < sphere.radius * 1e-5) {
|
||||
// It's possible test_support_points failed due to precision
|
||||
// issues
|
||||
break;
|
||||
}
|
||||
|
||||
best = 0;
|
||||
for (i = 0; i < num_points; i++) {
|
||||
if (&points[i] == support[0] || &points[i] == support[1]
|
||||
|| &points[i] == support[2])
|
||||
|
|
Loading…
Reference in a new issue