fix bounds
This commit is contained in:
parent
87be06dcbe
commit
22e1c6ae1d
@ -368,8 +368,11 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
||||
mirr_x, rot2 = normalize_mirror(ref.mirrored)
|
||||
if mirr_x:
|
||||
ubounds[:, 1] *= -1
|
||||
bounds = numpy.round(rotation_matrix_2d(ref.rotation + rot2)) @ ubounds
|
||||
# note: rounding fixes up
|
||||
|
||||
# note: rounding fixes up sin/cos inaccuracy, probably unnecessary
|
||||
corners = (numpy.round(rotation_matrix_2d(ref.rotation + rot2)) @ ubounds.T).T
|
||||
bounds = numpy.vstack((numpy.min(corners, axis=0),
|
||||
numpy.max(corners, axis=0))) * ref.scale + [ref.offset]
|
||||
|
||||
else:
|
||||
# Non-manhattan rotation, have to figure out bounds by rotating the pattern
|
||||
|
@ -236,8 +236,8 @@ class Grid(Repetition):
|
||||
Returns:
|
||||
`[[x_min, y_min], [x_max, y_max]]` or `None`
|
||||
"""
|
||||
a_extent = self.a_vector * self.a_count
|
||||
b_extent = self.b_vector * self.b_count if (self.b_vector is not None) else 0 # type: NDArray[numpy.float64] | float
|
||||
a_extent = self.a_vector * (self.a_count - 1)
|
||||
b_extent = self.b_vector * ((self.b_count - 1) if (self.b_vector is not None) else 0) # type: NDArray[numpy.float64] | float
|
||||
|
||||
corners = numpy.stack(((0, 0), a_extent, b_extent, a_extent + b_extent))
|
||||
xy_min = numpy.min(corners, axis=0)
|
||||
|
Loading…
Reference in New Issue
Block a user