From 1649853036e15e4c147d7913704663260425adc1 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 27 May 2017 13:47:15 -0700 Subject: ray: redo ray_3f_distance() This function isn't currently used, but its implementation was awful. --- src/modules/ray/ray_3f.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/modules') 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); } -- cgit v1.2.3