Cosmetic changes to argument lists
This commit is contained in:
parent
58353b7884
commit
16c6bfc70a
9 changed files with 85 additions and 73 deletions
|
|
@ -140,13 +140,13 @@ class Arc(Shape):
|
|||
radii: vector2,
|
||||
angles: vector2,
|
||||
width: float,
|
||||
poly_num_points: int=DEFAULT_POLY_NUM_POINTS,
|
||||
poly_max_arclen: float=None,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
rotation: float=0,
|
||||
poly_num_points: int = DEFAULT_POLY_NUM_POINTS,
|
||||
poly_max_arclen: float = None,
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
rotation: float = 0,
|
||||
mirrored: Tuple[bool] = (False, False),
|
||||
layer: int=0,
|
||||
dose: float=1.0):
|
||||
layer: int = 0,
|
||||
dose: float = 1.0):
|
||||
self.identifier = ()
|
||||
self.radii = radii
|
||||
self.angles = angles
|
||||
|
|
@ -167,7 +167,10 @@ class Arc(Shape):
|
|||
new._angles = self._angles.copy()
|
||||
return new
|
||||
|
||||
def to_polygons(self, poly_num_points: int=None, poly_max_arclen: float=None) -> List[Polygon]:
|
||||
def to_polygons(self,
|
||||
poly_num_points: int = None,
|
||||
poly_max_arclen: float = None,
|
||||
) -> List[Polygon]:
|
||||
if poly_num_points is None:
|
||||
poly_num_points = self.poly_num_points
|
||||
if poly_max_arclen is None:
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ class Circle(Shape):
|
|||
|
||||
def __init__(self,
|
||||
radius: float,
|
||||
poly_num_points: int=DEFAULT_POLY_NUM_POINTS,
|
||||
poly_max_arclen: float=None,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
layer: int=0,
|
||||
dose: float=1.0):
|
||||
poly_num_points: int = DEFAULT_POLY_NUM_POINTS,
|
||||
poly_max_arclen: float = None,
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
layer: int = 0,
|
||||
dose: float = 1.0):
|
||||
self.identifier = ()
|
||||
self.offset = numpy.array(offset, dtype=float)
|
||||
self.layer = layer
|
||||
|
|
@ -58,7 +58,10 @@ class Circle(Shape):
|
|||
new._offset = self._offset.copy()
|
||||
return new
|
||||
|
||||
def to_polygons(self, poly_num_points: int=None, poly_max_arclen: float=None) -> List[Polygon]:
|
||||
def to_polygons(self,
|
||||
poly_num_points: int = None,
|
||||
poly_max_arclen: float = None,
|
||||
) -> List[Polygon]:
|
||||
if poly_num_points is None:
|
||||
poly_num_points = self.poly_num_points
|
||||
if poly_max_arclen is None:
|
||||
|
|
|
|||
|
|
@ -81,13 +81,13 @@ class Ellipse(Shape):
|
|||
|
||||
def __init__(self,
|
||||
radii: vector2,
|
||||
poly_num_points: int=DEFAULT_POLY_NUM_POINTS,
|
||||
poly_max_arclen: float=None,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
rotation: float=0,
|
||||
poly_num_points: int = DEFAULT_POLY_NUM_POINTS,
|
||||
poly_max_arclen: float = None,
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
rotation: float = 0,
|
||||
mirrored: Tuple[bool] = (False, False),
|
||||
layer: int=0,
|
||||
dose: float=1.0):
|
||||
layer: int = 0,
|
||||
dose: float = 1.0):
|
||||
self.identifier = ()
|
||||
self.radii = radii
|
||||
self.offset = offset
|
||||
|
|
@ -106,8 +106,8 @@ class Ellipse(Shape):
|
|||
return new
|
||||
|
||||
def to_polygons(self,
|
||||
poly_num_points: int=None,
|
||||
poly_max_arclen: float=None
|
||||
poly_num_points: int = None,
|
||||
poly_max_arclen: float = None,
|
||||
) -> List[Polygon]:
|
||||
if poly_num_points is None:
|
||||
poly_num_points = self.poly_num_points
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ class Path(Shape):
|
|||
offset: vector2 = (0.0, 0.0),
|
||||
rotation: float = 0,
|
||||
mirrored: Tuple[bool] = (False, False),
|
||||
layer: int=0,
|
||||
dose: float=1.0,
|
||||
layer: int = 0,
|
||||
dose: float = 1.0,
|
||||
) -> 'Path':
|
||||
self._cap_extensions = None # Since .cap setter might access it
|
||||
|
||||
|
|
@ -180,11 +180,11 @@ class Path(Shape):
|
|||
width: float = 0.0,
|
||||
cap: 'Path.Cap' = Cap.Flush,
|
||||
cap_extensions = None,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
rotation: float = 0,
|
||||
mirrored: Tuple[bool] = (False, False),
|
||||
layer: int=0,
|
||||
dose: float=1.0,
|
||||
layer: int = 0,
|
||||
dose: float = 1.0,
|
||||
) -> 'Path':
|
||||
"""
|
||||
Build a path by specifying the turn angles and travel distances
|
||||
|
|
@ -220,8 +220,8 @@ class Path(Shape):
|
|||
layer=layer, dose=dose)
|
||||
|
||||
def to_polygons(self,
|
||||
poly_num_points: int=None,
|
||||
poly_max_arclen: float=None,
|
||||
poly_num_points: int = None,
|
||||
poly_max_arclen: float = None,
|
||||
) -> List['Polygon']:
|
||||
extensions = self._calculate_cap_extensions()
|
||||
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ class Polygon(Shape):
|
|||
|
||||
def __init__(self,
|
||||
vertices: numpy.ndarray,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
rotation: float=0.0,
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
rotation: float = 0.0,
|
||||
mirrored: Tuple[bool] = (False, False),
|
||||
layer: int=0,
|
||||
dose: float=1.0,
|
||||
layer: int = 0,
|
||||
dose: float = 1.0,
|
||||
):
|
||||
self.identifier = ()
|
||||
self.layer = layer
|
||||
|
|
@ -95,10 +95,10 @@ class Polygon(Shape):
|
|||
|
||||
@staticmethod
|
||||
def square(side_length: float,
|
||||
rotation: float=0.0,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
layer: int=0,
|
||||
dose: float=1.0
|
||||
rotation: float = 0.0,
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
layer: int = 0,
|
||||
dose: float = 1.0,
|
||||
) -> 'Polygon':
|
||||
"""
|
||||
Draw a square given side_length, centered on the origin.
|
||||
|
|
@ -122,10 +122,10 @@ class Polygon(Shape):
|
|||
@staticmethod
|
||||
def rectangle(lx: float,
|
||||
ly: float,
|
||||
rotation: float=0,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
layer: int=0,
|
||||
dose: float=1.0
|
||||
rotation: float = 0,
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
layer: int = 0,
|
||||
dose: float = 1.0,
|
||||
) -> 'Polygon':
|
||||
"""
|
||||
Draw a rectangle with side lengths lx and ly, centered on the origin.
|
||||
|
|
@ -156,7 +156,7 @@ class Polygon(Shape):
|
|||
ymax: float = None,
|
||||
ly: float = None,
|
||||
layer: int = 0,
|
||||
dose: float = 1.0
|
||||
dose: float = 1.0,
|
||||
) -> 'Polygon':
|
||||
"""
|
||||
Draw a rectangle by specifying side/center positions.
|
||||
|
|
@ -222,8 +222,8 @@ class Polygon(Shape):
|
|||
|
||||
|
||||
def to_polygons(self,
|
||||
_poly_num_points: int=None,
|
||||
_poly_max_arclen: float=None,
|
||||
_poly_num_points: int = None,
|
||||
_poly_max_arclen: float = None,
|
||||
) -> List['Polygon']:
|
||||
return [copy.deepcopy(self)]
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,10 @@ class Shape(metaclass=ABCMeta):
|
|||
self.translate(+pivot)
|
||||
return self
|
||||
|
||||
def manhattanize_fast(self, grid_x: numpy.ndarray, grid_y: numpy.ndarray) -> List['Polygon']:
|
||||
def manhattanize_fast(self,
|
||||
grid_x: numpy.ndarray,
|
||||
grid_y: numpy.ndarray,
|
||||
) -> List['Polygon']:
|
||||
"""
|
||||
Returns a list of polygons with grid-aligned ("Manhattan") edges approximating the shape.
|
||||
|
||||
|
|
@ -295,7 +298,10 @@ class Shape(metaclass=ABCMeta):
|
|||
return manhattan_polygons
|
||||
|
||||
|
||||
def manhattanize(self, grid_x: numpy.ndarray, grid_y: numpy.ndarray) -> List['Polygon']:
|
||||
def manhattanize(self,
|
||||
grid_x: numpy.ndarray,
|
||||
grid_y: numpy.ndarray
|
||||
) -> List['Polygon']:
|
||||
"""
|
||||
Returns a list of polygons with grid-aligned ("Manhattan") edges approximating the shape.
|
||||
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ class Text(Shape):
|
|||
string: str,
|
||||
height: float,
|
||||
font_path: str,
|
||||
offset: vector2=(0.0, 0.0),
|
||||
rotation: float=0.0,
|
||||
mirrored: Tuple[bool]=(False, False),
|
||||
layer: int=0,
|
||||
dose: float=1.0):
|
||||
offset: vector2 = (0.0, 0.0),
|
||||
rotation: float = 0.0,
|
||||
mirrored: Tuple[bool] = (False, False),
|
||||
layer: int = 0,
|
||||
dose: float = 1.0):
|
||||
self.offset = offset
|
||||
self.layer = layer
|
||||
self.dose = dose
|
||||
|
|
@ -95,8 +95,8 @@ class Text(Shape):
|
|||
return new
|
||||
|
||||
def to_polygons(self,
|
||||
_poly_num_points: int=None,
|
||||
_poly_max_arclen: float=None
|
||||
_poly_num_points: int = None,
|
||||
_poly_max_arclen: float = None,
|
||||
) -> List[Polygon]:
|
||||
all_polygons = []
|
||||
total_advance = 0
|
||||
|
|
@ -153,7 +153,7 @@ class Text(Shape):
|
|||
|
||||
def get_char_as_polygons(font_path: str,
|
||||
char: str,
|
||||
resolution: float=48*64,
|
||||
resolution: float = 48*64,
|
||||
) -> Tuple[List[List[List[float]]], float]:
|
||||
from freetype import Face
|
||||
from matplotlib.path import Path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue