浏览代码

Added a few missing functions to raymath

- Added Vector2MultiplyV
- Added Vector2DivideV
- Added Vector3Divide
- Added Vector3DivideV
pull/641/head
ChrisDill 6 年前
父节点
当前提交
1e1bbaa40b
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. +28
    -0
      src/raymath.h

+ 28
- 0
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)
{

||||||
x
 
000:0
正在加载...
取消
保存