From cdcff62411b21211701c0143e1207e0d4246bf80 Mon Sep 17 00:00:00 2001 From: KirottuM Date: Fri, 5 Feb 2021 18:49:47 +0200 Subject: [PATCH] Changed CheckCollisionPointPolygon to CheckCollisionPointPoly --- src/raylib.h | 2 +- src/shapes.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 84e5991bc..246faceb9 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1130,7 +1130,7 @@ RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference -RLAPI bool CheckCollisionPointPolygon(Vector2 polygon[], int vertexCount, Vector2 point); // Check if point is inside a polygon +RLAPI bool CheckCollisionPointPolygon(Vector2 point, Vector2 *polygon, int vertexCount); // Check if point is inside a polygon RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision //------------------------------------------------------------------------------------ diff --git a/src/shapes.c b/src/shapes.c index cc877e786..e82a88f04 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -1526,7 +1526,7 @@ bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, // Another function from GeeksForGeeks // Returns true if the point p lies inside the polygon[] with n vertices -bool CheckCollisionPointPolygon(Vector2 polygon[], int vertexCount, Vector2 point) +bool CheckCollisionPointPoly(Vector2 point, Vector2 *polygon, int vertexCount) { // There must be at least 3 vertices in polygon[] if (vertexCount < 3) return false; @@ -1643,7 +1643,6 @@ static float EaseCubicInOut(float t, float b, float c, float d) // Point inside polygon checking code // Credit to https://www.geeksforgeeks.org/how-to-check-if-a-given-point-lies-inside-a-polygon/ -#define INF 10000 // Given three colinear points p, q, r, the function checks if // point q lies on line segment 'pr' static bool OnSegment(Vector2 p, Vector2 q, Vector2 r)