Set standard constructor arg order and add rotation
and mirrored
args where reasonable
This commit is contained in:
parent
8dfb6d4440
commit
c6fac19fe0
@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Tuple
|
||||
import math
|
||||
import numpy
|
||||
from numpy import pi
|
||||
@ -141,19 +141,21 @@ class Arc(Shape):
|
||||
radii: vector2,
|
||||
angles: vector2,
|
||||
width: float,
|
||||
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):
|
||||
self.offset = offset
|
||||
self.layer = layer
|
||||
self.dose = dose
|
||||
self.radii = radii
|
||||
self.angles = angles
|
||||
self.width = width
|
||||
self.offset = offset
|
||||
self.rotation = rotation
|
||||
[self.mirror(a) for a, do in enumerate(mirrored) if do]
|
||||
self.layer = layer
|
||||
self.dose = dose
|
||||
self.poly_num_points = poly_num_points
|
||||
self.poly_max_arclen = poly_max_arclen
|
||||
|
||||
@ -201,8 +203,7 @@ class Arc(Shape):
|
||||
ys = numpy.hstack((ys1, ys2))
|
||||
xys = numpy.vstack((xs, ys)).T
|
||||
|
||||
poly = Polygon(xys, dose=self.dose, layer=self.layer, offset=self.offset)
|
||||
poly.rotate(self.rotation)
|
||||
poly = Polygon(xys, dose=self.dose, layer=self.layer, offset=self.offset, rotation=self.rotation)
|
||||
return [poly]
|
||||
|
||||
def get_bounds(self) -> numpy.ndarray:
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Tuple
|
||||
import math
|
||||
import numpy
|
||||
from numpy import pi
|
||||
@ -82,17 +82,19 @@ class Ellipse(Shape):
|
||||
|
||||
def __init__(self,
|
||||
radii: vector2,
|
||||
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):
|
||||
self.radii = radii
|
||||
self.offset = offset
|
||||
self.rotation = rotation
|
||||
[self.mirror(a) for a, do in enumerate(mirrored) if do]
|
||||
self.layer = layer
|
||||
self.dose = dose
|
||||
self.radii = radii
|
||||
self.rotation = rotation
|
||||
self.poly_num_points = poly_num_points
|
||||
self.poly_max_arclen = poly_max_arclen
|
||||
|
||||
@ -129,8 +131,7 @@ class Ellipse(Shape):
|
||||
ys = r1 * sin_th
|
||||
xys = numpy.vstack((xs, ys)).T
|
||||
|
||||
poly = Polygon(xys, dose=self.dose, layer=self.layer, offset=self.offset)
|
||||
poly.rotate(self.rotation)
|
||||
poly = Polygon(xys, dose=self.dose, layer=self.layer, offset=self.offset, rotation=self.rotation)
|
||||
return [poly]
|
||||
|
||||
def get_bounds(self) -> numpy.ndarray:
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Tuple
|
||||
import copy
|
||||
import numpy
|
||||
from numpy import pi
|
||||
@ -71,12 +71,17 @@ class Polygon(Shape):
|
||||
def __init__(self,
|
||||
vertices: numpy.ndarray,
|
||||
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
|
||||
dose: float=1.0,
|
||||
):
|
||||
self.layer = layer
|
||||
self.dose = dose
|
||||
self.vertices = vertices
|
||||
self.offset = offset
|
||||
self.rotate(rotation)
|
||||
[self.mirror(a) for a, do in enumerate(mirrored) if do]
|
||||
|
||||
@staticmethod
|
||||
def square(side_length: float,
|
||||
|
@ -61,15 +61,15 @@ class Text(Shape):
|
||||
def mirrored(self, val: List[bool]):
|
||||
if is_scalar(val):
|
||||
raise PatternError('Mirrored must be a 2-element list of booleans')
|
||||
self._mirrored = val
|
||||
self._mirrored = list(val)
|
||||
|
||||
def __init__(self,
|
||||
string: str,
|
||||
height: float,
|
||||
font_path: str,
|
||||
mirrored: List[bool]=None,
|
||||
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):
|
||||
self.offset = offset
|
||||
@ -79,8 +79,6 @@ class Text(Shape):
|
||||
self.height = height
|
||||
self.rotation = rotation
|
||||
self.font_path = font_path
|
||||
if mirrored is None:
|
||||
mirrored = [False, False]
|
||||
self.mirrored = mirrored
|
||||
|
||||
def to_polygons(self,
|
||||
|
Loading…
Reference in New Issue
Block a user