Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
returning a copy of the cached bounding box
Browse files Browse the repository at this point in the history
  • Loading branch information
tvt173 committed Dec 23, 2020
1 parent df1657e commit c4232c6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gdspy/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,16 @@ def get_bounding_box(self):
bb[0, 1] = min(bb[0, 1], all_points[1].min())
bb[1, 0] = max(bb[1, 0], all_points[0].max())
bb[1, 1] = max(bb[1, 1], all_points[1].max())
self._bounding_box = numpy.asarray(bb)
self._bounding_box = bb
else:
self._bounding_box = None
self._bb_valid = True
return self._bounding_box

if self._bounding_box is None:
return None
else:
# return a *copy* of the cached bounding box to ensure it doesn't get inadvertently modified
return numpy.array(self._bounding_box)

def get_polygons(self, by_spec=False, depth=None):
"""
Expand Down

0 comments on commit c4232c6

Please sign in to comment.