浏览代码

Update raymath.h (#1118)

* Update raymath.h

Added Vector2Rotate Function.

* Update raymath.h
pull/1120/head
i-right-i 5 年前
committed by GitHub
父节点
当前提交
3c2ee1cc75
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. +8
    -0
      src/raymath.h

+ 8
- 0
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
//----------------------------------------------------------------------------------

正在加载...
取消
保存