From 36e09984caf358498b1f8c012c2f4bce8f3e95ad Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 2 Oct 2018 00:55:32 -0700 Subject: v3f: add scalar division --- v3f.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/v3f.h b/v3f.h index ce80a9b..b23c33d 100644 --- a/v3f.h +++ b/v3f.h @@ -80,6 +80,20 @@ static inline v3f_t * pv3f_mult_scalar(const v3f_t *v, float scalar, v3f_t *res) } +static inline v3f_t v3f_div_scalar(const v3f_t *v, float scalar) +{ + return v3f_mult_scalar(v, 1.f / scalar); +} + + +static inline v3f_t * pv3f_div_scalar(const v3f_t *v, float scalar, v3f_t *res) +{ + *res = v3f_div_scalar(v, scalar); + + return res; +} + + static inline float v3f_dot(const v3f_t *a, const v3f_t *b) { return a->x * b->x + a->y * b->y + a->z * b->z; -- cgit v1.2.3