From d14c51aa2a5d04ff3ab69ea719ed3e26499ae2a0 Mon Sep 17 00:00:00 2001 From: ThePituLegend Date: Thu, 14 May 2020 23:31:58 +0300 Subject: [PATCH] Introduced Vector2 and Vector3 Square Lenght. (#1248) * Introduced Vector2 and Vector3 Square Lenght. * Square length functions renamed --- src/raymath.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/raymath.h b/src/raymath.h index 0eb423a01..662ce25c2 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -207,6 +207,13 @@ RMDEF float Vector2Length(Vector2 v) return result; } +// Calculate vector square length +RMDEF float Vector2LengthSqr(Vector2 v) +{ + float result = (v.x*v.x) + (v.y*v.y); + return result; +} + // Calculate two vectors dot product RMDEF float Vector2DotProduct(Vector2 v1, Vector2 v2) { @@ -401,6 +408,13 @@ RMDEF float Vector3Length(const Vector3 v) return result; } +// Calculate vector square length +RMDEF float Vector3LengthSqr(const Vector3 v) +{ + float result = v.x*v.x + v.y*v.y + v.z*v.z; + return result; +} + // Calculate two vectors dot product RMDEF float Vector3DotProduct(Vector3 v1, Vector3 v2) {