Skip to content

Commit 4ea4f95

Browse files
committed
Ensure a minimum smoothness for small radii
1 parent 35dfd1f commit 4ea4f95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gameobjects/shape/rectangle/Rectangle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ var Rectangle = new Class({
215215
var x = halfWidth;
216216
var y = halfHeight;
217217

218-
// The number of segments is based on radius (more segments = larger radius)
219-
var segments = Math.max(1, Math.floor(radius / 5));
218+
// Ensure minimum smoothness for small radii while preventing excessive tessellation
219+
var segments = Math.max(4, Math.min(16, Math.ceil(radius / 2)));
220220

221221
// Create points going clockwise from top-left
222222

0 commit comments

Comments
 (0)