This commit is contained in:
jan 2023-01-19 22:20:16 -08:00
commit d9ae8dd6e3
15 changed files with 149 additions and 443 deletions

View file

@ -21,8 +21,12 @@ class Arc(Shape, metaclass=AutoSlots):
The rotation gives the angle from x-axis, counterclockwise, to the first (x) radius.
The start and stop angle are measured counterclockwise from the first (x) radius.
"""
__slots__ = ('_radii', '_angles', '_width', '_rotation',
'poly_num_points', 'poly_max_arclen')
__slots__ = (
'_radii', '_angles', '_width', '_rotation',
'poly_num_points', 'poly_max_arclen',
# Inherited
'_offset', '_layer', '_repetition', '_annotations',
)
_radii: NDArray[numpy.float64]
""" Two radii for defining an ellipse """

View file

@ -15,7 +15,11 @@ class Circle(Shape, metaclass=AutoSlots):
"""
A circle, which has a position and radius.
"""
__slots__ = ('_radius', 'poly_num_points', 'poly_max_arclen')
__slots__ = (
'_radius', 'poly_num_points', 'poly_max_arclen',
# Inherited
'_offset', '_layer', '_repetition', '_annotations',
)
_radius: float
""" Circle radius """

View file

@ -17,8 +17,12 @@ class Ellipse(Shape, metaclass=AutoSlots):
An ellipse, which has a position, two radii, and a rotation.
The rotation gives the angle from x-axis, counterclockwise, to the first (x) radius.
"""
__slots__ = ('_radii', '_rotation',
'poly_num_points', 'poly_max_arclen')
__slots__ = (
'_radii', '_rotation',
'poly_num_points', 'poly_max_arclen',
# Inherited
'_offset', '_layer', '_repetition', '_annotations',
)
_radii: NDArray[numpy.float64]
""" Ellipse radii """

View file

@ -28,7 +28,11 @@ class Path(Shape, metaclass=AutoSlots):
A normalized_form(...) is available, but can be quite slow with lots of vertices.
"""
__slots__ = ('_vertices', '_width', '_cap', '_cap_extensions')
__slots__ = (
'_vertices', '_width', '_cap', '_cap_extensions',
# Inherited
'_offset', '_layer', '_repetition', '_annotations',
)
_vertices: NDArray[numpy.float64]
_width: float
_cap: PathCap

View file

@ -19,7 +19,11 @@ class Polygon(Shape, metaclass=AutoSlots):
A `normalized_form(...)` is available, but can be quite slow with lots of vertices.
"""
__slots__ = ('_vertices',)
__slots__ = (
'_vertices',
# Inherited
'_offset', '_layer', '_repetition', '_annotations',
)
_vertices: NDArray[numpy.float64]
""" Nx2 ndarray of vertices `[[x0, y0], [x1, y1], ...]` """

View file

@ -17,7 +17,7 @@ if TYPE_CHECKING:
# Type definitions
normalized_shape_tuple = Tuple[
Tuple,
Tuple[NDArray[numpy.float64], float, float, bool, float],
Tuple[NDArray[numpy.float64], float, float, bool],
Callable[[], 'Shape'],
]

View file

@ -22,7 +22,11 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
Text (to be printed e.g. as a set of polygons).
This is distinct from non-printed Label objects.
"""
__slots__ = ('_string', '_height', '_mirrored', 'font_path')
__slots__ = (
'_string', '_height', '_mirrored', 'font_path',
# Inherited
'_offset', '_layer', '_repetition', '_annotations', '_rotation',
)
_string: str
_height: float