From 1e1bbaa40b75dab8a534fdb447354adfc02b2333 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Thu, 13 Sep 2018 11:43:10 +0100 Subject: [PATCH] Added a few missing functions to raymath - Added Vector2MultiplyV - Added Vector2DivideV - Added Vector3Divide - Added Vector3DivideV --- src/raymath.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/raymath.h b/src/raymath.h index dfc431818..073a47b26 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -223,6 +223,13 @@ RMDEF Vector2 Vector2Scale(Vector2 v, float scale) return result; } +// Multiply vector by vector +RMDEF Vector2 Vector2MultiplyV(Vector2 v1, Vector2 v2) +{ + Vector2 result = { v1.x*v2.x, v1.y*v2.y }; + return result; +} + // Negate vector RMDEF Vector2 Vector2Negate(Vector2 v) { @@ -237,6 +244,13 @@ RMDEF Vector2 Vector2Divide(Vector2 v, float div) return result; } +// Divide vector by vector +RMDEF Vector2 Vector2DivideV(Vector2 v1, Vector2 v2) +{ + Vector2 result = { v1.x/v2.x, v1.y/v2.y }; + return result; +} + // Normalize provided vector RMDEF Vector2 Vector2Normalize(Vector2 v) { @@ -361,6 +375,20 @@ RMDEF Vector3 Vector3Negate(Vector3 v) return result; } +// Divide vector by a float value +RMDEF Vector3 Vector3Divide(Vector3 v, float div) +{ + Vector3 result = { v.x / div, v.y / div, v.z / div }; + return result; +} + +// Divide vector by vector +RMDEF Vector3 Vector3DivideV(Vector3 v1, Vector3 v2) +{ + Vector3 result = { v1.x/v2.x, v1.y/v2.y, v1.z/v2.z }; + return result; +} + // Normalize provided vector RMDEF Vector3 Vector3Normalize(Vector3 v) {