Fix / simplify some cases where the arc is a sector

This commit is contained in:
Jan Petykiewicz 2022-06-08 21:00:56 -07:00
parent eb9682b1b8
commit b188589b60

View File

@ -245,7 +245,7 @@ class Arc(Shape, metaclass=AutoSlots):
num_points = int(round(max(n))) num_points = int(round(max(n)))
wh = self.width / 2.0 wh = self.width / 2.0
if wh == r0 and r0 == r1: if wh == r0 or wh == r1:
thetas_inner = numpy.zeros(1) # Don't generate multiple vertices if we're at the origin thetas_inner = numpy.zeros(1) # Don't generate multiple vertices if we're at the origin
else: else:
thetas_inner = numpy.linspace(a_ranges[0][1], a_ranges[0][0], num_points, endpoint=True) thetas_inner = numpy.linspace(a_ranges[0][1], a_ranges[0][0], num_points, endpoint=True)
@ -288,6 +288,12 @@ class Arc(Shape, metaclass=AutoSlots):
rx = self.radius_x + wh rx = self.radius_x + wh
ry = self.radius_y + wh ry = self.radius_y + wh
if rx == 0 or ry == 0:
# Single point, at origin
mins.append([0, 0])
maxs.append([0, 0])
continue
a0, a1 = a a0, a1 = a
a0_offset = a0 - (a0 % (2 * pi)) a0_offset = a0 - (a0 % (2 * pi))