Add Mobject.get_all_corners

This commit is contained in:
Grant Sanderson 2022-04-20 21:43:16 -07:00
parent 50f5d20cc3
commit f636199d9a

View file

@ -1235,6 +1235,13 @@ class Mobject(object):
def get_corner(self, direction: np.ndarray) -> np.ndarray:
return self.get_bounding_box_point(direction)
def get_all_corners(self):
bb = self.get_bounding_box()
return np.array([
[bb[indices[-i + 1]][i] for i in range(3)]
for indices in it.product(*3 * [[0, 2]])
])
def get_center(self) -> np.ndarray:
return self.get_bounding_box()[1]