summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2018-10-02 00:53:07 -0700
committerVito Caputo <vcaputo@pengaru.com>2018-10-02 00:53:07 -0700
commitf9985ecbf681d9652642cb424c3ca49c2578a096 (patch)
treea5ab4c2ca1970d7439f76fb3d6f4aaabd9f733b1
parentb7be56cd9d90347daa59f007ef311f6fe92fae3a (diff)
v2f: add scalar division
-rw-r--r--v2f.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/v2f.h b/v2f.h
index 4867035..23f6550 100644
--- a/v2f.h
+++ b/v2f.h
@@ -80,6 +80,20 @@ static inline v2f_t * pv2f_mult_scalar(const v2f_t *v, float scalar, v2f_t *res)
}
+static inline v2f_t v2f_div_scalar(const v2f_t *v, float scalar)
+{
+ return v2f_mult_scalar(v, 1.f / scalar);
+}
+
+
+static inline v2f_t * pv2f_div_scalar(const v2f_t *v, float scalar, v2f_t *res)
+{
+ *res = v2f_div_scalar(v, scalar);
+
+ return res;
+}
+
+
static inline float v2f_dot(const v2f_t *a, const v2f_t *b)
{
return a->x * b->x + a->y * b->y;
© All Rights Reserved