diff options
| author | ThePituLegend <[email protected]> | 2020-05-14 23:31:58 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-14 22:31:58 +0200 |
| commit | d14c51aa2a5d04ff3ab69ea719ed3e26499ae2a0 (patch) | |
| tree | 13878654c5429967cdd723598dd75802be230998 | |
| parent | 7b001164ef2cd3b3bb481394f194baa574963b13 (diff) | |
| download | raylib-d14c51aa2a5d04ff3ab69ea719ed3e26499ae2a0.tar.gz raylib-d14c51aa2a5d04ff3ab69ea719ed3e26499ae2a0.zip | |
Introduced Vector2 and Vector3 Square Lenght. (#1248)
* Introduced Vector2 and Vector3 Square Lenght.
* Square length functions renamed
| -rw-r--r-- | src/raymath.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/raymath.h b/src/raymath.h index 0eb423a0..662ce25c 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) { |
