Make sure linspace gets an integer number of points

This commit is contained in:
Jan Petykiewicz 2020-07-21 20:38:38 -07:00
commit 0fa073b488
3 changed files with 7 additions and 4 deletions

View file

@ -139,7 +139,8 @@ class Ellipse(Shape):
n += [poly_num_points]
if poly_max_arclen is not None:
n += [perimeter / poly_max_arclen]
thetas = numpy.linspace(2 * pi, 0, max(n), endpoint=False)
num_points = int(round(max(n)))
thetas = numpy.linspace(2 * pi, 0, num_points, endpoint=False)
sin_th, cos_th = (numpy.sin(thetas), numpy.cos(thetas))
xs = r0 * cos_th