From c15f3214d5d934f87f9aabe603db8666d9532b78 Mon Sep 17 00:00:00 2001 From: Matthew Roush Date: Fri, 24 Jul 2026 15:38:50 -0400 Subject: [PATCH] [rshapes] Correct `DrawPolyLinesEx()` line thickness. (#6014) Follow up to #6004. The previous formula would produce inconsistent results for different polygons with the same `thick` parameter. --- src/rshapes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rshapes.c b/src/rshapes.c index 0f4ae8ead..76fb0c3c2 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -1265,7 +1265,8 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl if (sides < 3) sides = 3; float centralAngle = rotation*DEG2RAD; float exteriorAngle = 360.0f/(float)sides*DEG2RAD; - float innerRadius = fmaxf(0.0f, radius - (thick*cosf(DEG2RAD*exteriorAngle/2.0f))); + float apothem = radius*cosf(DEG2RAD*180.0f/(float)sides); + float innerRadius = fmaxf(0.0f, radius - thick*(radius/apothem)); #if SUPPORT_QUADS_DRAW_MODE rlSetTexture(GetShapesTexture().id);