[raymath] Hotfix for Vector2Angle and corresponding example

This commit is contained in:
Brett 2023-10-10 04:08:52 -04:00
commit 5061fed120
2 changed files with 6 additions and 14 deletions

View File

@ -44,11 +44,7 @@ int main(void)
//----------------------------------------------------------------------------------
float startangle;
<<<<<<< HEAD
if (angleMode == 0) startangle = Vector2LineAngle(v0, v1)*RAD2DEG;
=======
if (angleMode == 0) startangle = -Vector2LineAngle(v0, v1)*RAD2DEG;
>>>>>>> b5edafafe17c950722d4c5fd6c705f6aff74a65f
if (angleMode == 1) startangle = 0.0f;
v2 = GetMousePosition();
@ -86,11 +82,8 @@ int main(void)
DrawLineEx(v0, v1, 2.0f, BLACK);
DrawLineEx(v0, v2, 2.0f, RED);
<<<<<<< HEAD
DrawCircleSector(v0, 40.0f, startangle, startangle + angle, 32, Fade(GREEN, 0.6f));
=======
DrawCircleSector(v0, 40.0f, startangle, startangle - angle, 32, Fade(GREEN, 0.6f));
>>>>>>> b5edafafe17c950722d4c5fd6c705f6aff74a65f
}
else if (angleMode == 1)
{
@ -99,11 +92,7 @@ int main(void)
DrawLine(0, screenHeight/2, screenWidth, screenHeight/2, LIGHTGRAY);
DrawLineEx(v0, v2, 2.0f, RED);
<<<<<<< HEAD
DrawCircleSector(v0, 40.0f, startangle, startangle + angle, 32, Fade(GREEN, 0.6f));
=======
DrawCircleSector(v0, 40.0f, startangle, startangle - angle, 32, Fade(GREEN, 0.6f));
>>>>>>> b5edafafe17c950722d4c5fd6c705f6aff74a65f
}
DrawText("v0", v0.x, v0.y, 10, DARKGRAY);

View File

@ -324,9 +324,12 @@ RMAPI float Vector2Angle(Vector2 v1, Vector2 v2)
float dot = v1.x*v2.x + v1.y*v2.y;
float det = v1.x*v2.y - v1.y*v2.x;
<<<<<<< HEAD
<<<<<<< HEAD
result = atan2f(det, dot);
=======
=======
>>>>>>> origin
// TODO(10/9/2023): Currently angles move clockwise, determine if this is wanted behavior
result = -atan2f(det, dot);
>>>>>>> b5edafafe17c950722d4c5fd6c705f6aff74a65f