summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-03-31 18:40:33 +0200
committerraysan5 <[email protected]>2021-03-31 18:40:33 +0200
commit8e51e6d1dff309f9fa51bfd6cf45dee2da1b89b4 (patch)
treec2b5363e302a4c546160170874e1b2dd8e4ed515
parentfd3e2fda000512aeb70d7f5fa703e5c78007ee35 (diff)
downloadraylib-8e51e6d1dff309f9fa51bfd6cf45dee2da1b89b4.tar.gz
raylib-8e51e6d1dff309f9fa51bfd6cf45dee2da1b89b4.zip
REVIEWED: CheckCollisionPointLine()
Use fabsf() instead of abs()
-rw-r--r--src/shapes.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/shapes.c b/src/shapes.c
index 789a1f70..7ab947ba 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -1555,11 +1555,10 @@ bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshol
float dyl = p2.y - p1.y;
float cross = dxc*dyl - dyc*dxl;
- if (abs(cross) < threshold*fmaxf(fabsf(dxl), fabsf(dyl)))
+ if (fabsf(cross) < (threshold*fmaxf(fabsf(dxl), fabsf(dyl))))
{
if (fabsf(dxl) >= fabsf(dyl)) collision = (dxl > 0)? ((p1.x <= point.x) && (point.x <= p2.x)) : ((p2.x <= point.x) && (point.x <= p1.x));
- else
- collision = (dyl > 0)? ((p1.y <= point.y) && (point.y <= p2.y)) : ((p2.y <= point.y) && (point.y <= p1.y));
+ else collision = (dyl > 0)? ((p1.y <= point.y) && (point.y <= p2.y)) : ((p2.y <= point.y) && (point.y <= p1.y));
}
return collision;