mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add Mobject.get_all_corners
This commit is contained in:
parent
50f5d20cc3
commit
f636199d9a
1 changed files with 7 additions and 0 deletions
|
@ -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]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue