mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-30 20:37:47 +00:00
[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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user