summaryrefslogtreecommitdiff
path: root/src/modules/ray/ray_3f.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2017-05-27 13:47:15 -0700
committerVito Caputo <vcaputo@pengaru.com>2017-05-27 13:47:15 -0700
commit1649853036e15e4c147d7913704663260425adc1 (patch)
treeedcad237dfce9df45bd1a077866be699cfd6536d /src/modules/ray/ray_3f.h
parent14b972b114ac02d83ad1bd7e1dd5f48b948607c1 (diff)
ray: redo ray_3f_distance()
This function isn't currently used, but its implementation was awful.
Diffstat (limited to 'src/modules/ray/ray_3f.h')
-rw-r--r--src/modules/ray/ray_3f.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/modules/ray/ray_3f.h b/src/modules/ray/ray_3f.h
index 8408abb..e0e6dc3 100644
--- a/src/modules/ray/ray_3f.h
+++ b/src/modules/ray/ray_3f.h
@@ -119,7 +119,9 @@ static inline ray_3f_t ray_3f_normalize(ray_3f_t *v)
/* return the distance between two arbitrary points */
static inline float ray_3f_distance(ray_3f_t *a, ray_3f_t *b)
{
- return sqrtf(powf(a->x - b->x, 2) + powf(a->y - b->y, 2) + powf(a->z - b->z, 2));
+ ray_3f_t delta = ray_3f_sub(a, b);
+
+ return ray_3f_length(&delta);
}
© All Rights Reserved