From c515ada2f816e69da3fbc1b17f097992b7859b1b Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 19 Mar 2023 10:17:09 -0700 Subject: [PATCH] updates to Pattern.polygonize() --- masque/pattern.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/masque/pattern.py b/masque/pattern.py index 8c2ea7c..ecd9787 100644 --- a/masque/pattern.py +++ b/masque/pattern.py @@ -12,7 +12,7 @@ from numpy.typing import NDArray, ArrayLike # .visualize imports matplotlib and matplotlib.collections from .ref import Ref -from .shapes import Shape, Polygon +from .shapes import Shape, Polygon, DEFAULT_POLY_NUM_VERTICES from .label import Label from .utils import rotation_matrix_2d, annotations_t from .error import PatternError @@ -210,7 +210,7 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable): def polygonize( self, - num_points: int | None = None, + num_vertices: int | None = DEFAULT_POLY_NUM_VERTICES, max_arclen: float | None = None, ) -> Self: """ @@ -218,7 +218,7 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable): Arguments are passed directly to `shape.to_polygons(...)`. Args: - num_points: Number of points to use for each polygon. Can be overridden by + num_vertices: Number of points to use for each polygon. Can be overridden by `max_arclen` if that results in more points. Optional, defaults to shapes' internal defaults. max_arclen: Maximum arclength which can be approximated by a single line @@ -229,7 +229,7 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable): """ old_shapes = self.shapes self.shapes = list(chain.from_iterable(( - shape.to_polygons(num_points, max_arclen) + shape.to_polygons(num_vertices, max_arclen) for shape in old_shapes))) return self