[Ref] get_bounds_single shoudl ignore repetition
This commit is contained in:
parent
0c9b435e94
commit
f0eea0382b
2 changed files with 20 additions and 1 deletions
|
|
@ -236,7 +236,10 @@ class Ref(
|
|||
bounds = numpy.vstack((numpy.min(corners, axis=0),
|
||||
numpy.max(corners, axis=0))) * self.scale + [self.offset]
|
||||
return bounds
|
||||
return self.as_pattern(pattern=pattern).get_bounds(library)
|
||||
|
||||
single_ref = self.deepcopy()
|
||||
single_ref.repetition = None
|
||||
return single_ref.as_pattern(pattern=pattern).get_bounds(library)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
rotation = f' r{numpy.rad2deg(self.rotation):g}' if self.rotation != 0 else ''
|
||||
|
|
|
|||
|
|
@ -64,6 +64,22 @@ def test_ref_get_bounds() -> None:
|
|||
assert_equal(bounds, [[10, 10], [20, 20]])
|
||||
|
||||
|
||||
def test_ref_get_bounds_single_ignores_repetition_for_non_manhattan_rotation() -> None:
|
||||
sub_pat = Pattern()
|
||||
sub_pat.rect((1, 0), xmin=0, xmax=1, ymin=0, ymax=2)
|
||||
|
||||
rep = Grid(a_vector=(5, 0), b_vector=(0, 7), a_count=3, b_count=2)
|
||||
ref = Ref(offset=(10, 20), rotation=pi / 4, repetition=rep)
|
||||
|
||||
bounds = ref.get_bounds_single(sub_pat)
|
||||
repeated_bounds = ref.get_bounds(sub_pat)
|
||||
|
||||
assert bounds is not None
|
||||
assert repeated_bounds is not None
|
||||
assert repeated_bounds[1, 0] > bounds[1, 0]
|
||||
assert repeated_bounds[1, 1] > bounds[1, 1]
|
||||
|
||||
|
||||
def test_ref_copy() -> None:
|
||||
ref1 = Ref(offset=(1, 2), rotation=0.5, annotations={"a": [1]})
|
||||
ref2 = ref1.copy()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue