mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-08 19:06:27 +00:00
Added Vector2 math functions
Reviewed some Vector3 functions Added auxiliary Clamp() function
This commit is contained in:
@@ -213,8 +213,11 @@ static unsigned int enabledGestures = 0b0000001111111111;
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module specific Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
#if defined(GESTURES_STANDALONE)
|
||||
// Some required math functions provided by raymath.h
|
||||
static float Vector2Angle(Vector2 initialPosition, Vector2 finalPosition);
|
||||
static float Vector2Distance(Vector2 v1, Vector2 v2);
|
||||
#endif
|
||||
static double GetCurrentTime(void);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -477,13 +480,11 @@ float GetGesturePinchAngle(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module specific Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#if defined(GESTURES_STANDALONE)
|
||||
// Returns angle from two-points vector with X-axis
|
||||
static float Vector2Angle(Vector2 initialPosition, Vector2 finalPosition)
|
||||
static float Vector2Angle(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
float angle;
|
||||
|
||||
angle = atan2f(finalPosition.y - initialPosition.y, finalPosition.x - initialPosition.x)*(180.0f/PI);
|
||||
float angle = angle = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/PI);
|
||||
|
||||
if (angle < 0) angle += 360.0f;
|
||||
|
||||
@@ -502,6 +503,7 @@ static float Vector2Distance(Vector2 v1, Vector2 v2)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Time measure returned are milliseconds
|
||||
static double GetCurrentTime(void)
|
||||
|
Reference in New Issue
Block a user