summaryrefslogtreecommitdiffstats
path: root/libdimension/sphere.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/sphere.c')
-rw-r--r--libdimension/sphere.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libdimension/sphere.c b/libdimension/sphere.c
index a3f0c90..96bc617 100644
--- a/libdimension/sphere.c
+++ b/libdimension/sphere.c
@@ -23,7 +23,7 @@
* Spheres.
*/
-#include "dimension.h"
+#include "dimension-internal.h"
/** Sphere intersection callback. */
static bool
@@ -41,7 +41,8 @@ dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line l,
return false;
} else {
double t = x[0];
- if (n == 2)
+ /* Optimize for the case where we're outside the sphere */
+ if (dmnsn_likely(n == 2))
t = dmnsn_min(t, x[1]);
intersection->t = t;