Compare commits

...

2 Commits

@ -4,6 +4,7 @@ Simplified Pattern assembly (`Builder`)
from typing import Self, Sequence, Mapping from typing import Self, Sequence, Mapping
import copy import copy
import logging import logging
from functools import wraps
from numpy.typing import ArrayLike from numpy.typing import ArrayLike
@ -188,6 +189,26 @@ class Builder(PortList):
new = Builder(library=library, pattern=pat, name=name) new = Builder(library=library, pattern=pat, name=name)
return new return new
@wraps(Pattern.label)
def label(self, *args, **kwargs) -> Self:
self.pattern.label(*args, **kwargs)
@wraps(Pattern.ref)
def ref(self, *args, **kwargs) -> Self:
self.pattern.ref(*args, **kwargs)
@wraps(Pattern.polygon)
def polygon(self, *args, **kwargs) -> Self:
self.pattern.polygon(*args, **kwargs)
@wraps(Pattern.rect)
def rect(self, *args, **kwargs) -> Self:
self.pattern.rect(*args, **kwargs)
@wraps(Pattern.path)
def path(self, *args, **kwargs) -> Self:
self.pattern.path(*args, **kwargs)
def plug( def plug(
self, self,
other: Abstract | str | Pattern | TreeView, other: Abstract | str | Pattern | TreeView,

@ -235,14 +235,16 @@ class Arc(Shape):
n_pts = numpy.ceil(2 * pi * max(self.radii) / max_arclen).astype(int) n_pts = numpy.ceil(2 * pi * max(self.radii) / max_arclen).astype(int)
arc_lengths, thetas = get_arclens(n_pts, *a_ranges[0 if inner else 1]) arc_lengths, thetas = get_arclens(n_pts, *a_ranges[0 if inner else 1])
keep = [] keep = [0]
removable = (numpy.cumsum(arc_lengths) <= max_arclen) removable = (numpy.cumsum(arc_lengths) <= max_arclen)
start = 0 start = 1
while start < arc_lengths.size: while start < arc_lengths.size:
next_to_keep = start + numpy.where(removable)[0][-1] # TODO: any chance we haven't sampled finely enough? next_to_keep = start + numpy.where(removable)[0][-1] # TODO: any chance we haven't sampled finely enough?
keep.append(next_to_keep) keep.append(next_to_keep)
removable = (numpy.cumsum(arc_lengths[next_to_keep + 1:]) <= max_arclen) removable = (numpy.cumsum(arc_lengths[next_to_keep + 1:]) <= max_arclen)
start = next_to_keep + 1 start = next_to_keep + 1
if keep[-1] != thetas.size - 1:
keep.append(thetas.size -1)
return thetas[keep] return thetas[keep]
wh = self.width / 2.0 wh = self.width / 2.0

Loading…
Cancel
Save