This commit is contained in:
Adrian Mariano 2024-05-22 21:51:01 -04:00
parent f3b35eab0a
commit 04437cc6a0

View File

@ -852,15 +852,17 @@ function arc(n, r, angle, d, cp, points, corner, width, thickness, start, wedge=
theta_end = atan2(points[1].y-cp.y, points[1].x-cp.x), theta_end = atan2(points[1].y-cp.y, points[1].x-cp.x),
angle = posmod(theta_end-theta_start, 360), angle = posmod(theta_end-theta_start, 360),
// Specify endpoints exactly; skip those endpoints when producing arc points // Specify endpoints exactly; skip those endpoints when producing arc points
// Generating the whole arc and clipping ends is the easiest way to ensure that we
// generate the proper number of points.
arcpts = [ if (wedge) cp, arcpts = [ if (wedge) cp,
points[0], points[0],
each arc(n-2,cp=cp,r=r,start=theta_start+angle/(n-1),angle=angle-2*angle/(n-1)), each select(arc(n,cp=cp,r=r,start=theta_start,angle=angle),1,-2),
points[1] points[1]
] ]
) )
dir ? arcpts dir ? arcpts
: wedge ? reverse_polygon(arcpts) : wedge ? reverse_polygon(arcpts) // Keep the centerpoint at position 0 in the list
: reverse(arcpts); : reverse(arcpts);