From c1e3b23ddd8bba5a4276254aaf9d6812575b3c6b Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 13 Oct 2024 12:10:32 -0400 Subject: [PATCH] Pointy line join fix --- arc-core/src/arc/graphics/g2d/Lines.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arc-core/src/arc/graphics/g2d/Lines.java b/arc-core/src/arc/graphics/g2d/Lines.java index 2c7b33e1..ab9cc540 100644 --- a/arc-core/src/arc/graphics/g2d/Lines.java +++ b/arc-core/src/arc/graphics/g2d/Lines.java @@ -248,7 +248,8 @@ private static void preparePointyJoin(Vec2 A, Vec2 B, Vec2 C, Vec2 D, Vec2 E, fl prepareStraightJoin(B, D, E, halfLineWidth); return; } - float len = (float)(halfLineWidth / Math.sin(angle)); + //clamps length to avoid super sharp edges. this looks pretty bad, but it's better than the alternative of a 1-pixel line to infinity + float len = Mathf.clamp((float)(halfLineWidth / Math.sin(angle)), -halfLineWidth*10f, halfLineWidth*10f); boolean bendsLeft = angle < 0; AB.setLength(len); BC.setLength(len);