diff options
| author | i-right-i <[email protected]> | 2020-03-02 03:22:08 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-03-02 10:22:08 +0100 |
| commit | 3c2ee1cc75ebd59bee343cdc28902b431a599db6 (patch) | |
| tree | a7fe8f5dfa6763f1e83cd90a07308044758c5849 /src/raymath.h | |
| parent | 117696a8936007592f7fe7c0b7b227a805e3b74a (diff) | |
| download | raylib-3c2ee1cc75ebd59bee343cdc28902b431a599db6.tar.gz raylib-3c2ee1cc75ebd59bee343cdc28902b431a599db6.zip | |
Update raymath.h (#1118)
* Update raymath.h
Added Vector2Rotate Function.
* Update raymath.h
Diffstat (limited to 'src/raymath.h')
| -rw-r--r-- | src/raymath.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/raymath.h b/src/raymath.h index c2dbc61e..b30a5cfa 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -268,6 +268,14 @@ RMDEF Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount) return result; } +// Rotate Vector by float in Degrees. +RMDEF Vector2 Vector2Rotate(Vector2 v, float degs) +{ + float rads = degs*DEG2RAD; + Vector2 result = {v.x * cosf(rads) - v.y * sinf(rads) , v.x * sinf(rads) + v.y * cosf(rads) }; + return result; +} + //---------------------------------------------------------------------------------- // Module Functions Definition - Vector3 math //---------------------------------------------------------------------------------- |
