From 574b464a3cca47d3dc46328aa07b286bbddbb2c2 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 13 Feb 2020 10:54:09 -0800 Subject: [PATCH] get_critical_point -> get_bounding_box_point --- from_3b1b/active/bayes/part1.py | 2 +- from_3b1b/old/domino_play.py | 2 +- from_3b1b/old/wcat.py | 2 +- manimlib/animation/growing.py | 2 +- manimlib/mobject/mobject.py | 24 ++++++++++++------------ manimlib/mobject/svg/drawings.py | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/from_3b1b/active/bayes/part1.py b/from_3b1b/active/bayes/part1.py index 1a8c6c06..57579dc3 100644 --- a/from_3b1b/active/bayes/part1.py +++ b/from_3b1b/active/bayes/part1.py @@ -3905,7 +3905,7 @@ class RandomnessVsProportions(Scene): arrangements = VGroup(*[ VGroup(*[ - dot.copy().move_to(square.get_critical_point(ec)) + dot.copy().move_to(square.get_bounding_box_point(ec)) for ec in edge_group ]) for edge_group in edge_groups diff --git a/from_3b1b/old/domino_play.py b/from_3b1b/old/domino_play.py index e1507391..ff47d1e4 100644 --- a/from_3b1b/old/domino_play.py +++ b/from_3b1b/old/domino_play.py @@ -841,7 +841,7 @@ class Test(Scene): arcs = VGroup(arc1, arc2) for arc, vect in zip(arcs, [DOWN+RIGHT, RIGHT]): arc_copy = arc.copy() - point = domino1.get_critical_point(vect) + point = domino1.get_bounding_box_point(vect) arc_copy.add_line_to([point]) arc_copy.set_stroke(width = 0) arc_copy.set_fill( diff --git a/from_3b1b/old/wcat.py b/from_3b1b/old/wcat.py index fd82bc04..37fc0a6b 100644 --- a/from_3b1b/old/wcat.py +++ b/from_3b1b/old/wcat.py @@ -1280,7 +1280,7 @@ class EndpointsGluedTogether(ClosedLoopScene): self.loop = line dots = VGroup(*[ - Dot(line.get_critical_point(vect)) + Dot(line.get_bounding_box_point(vect)) for vect in (LEFT, RIGHT) ]) dots.set_color(BLUE) diff --git a/manimlib/animation/growing.py b/manimlib/animation/growing.py index e2a53cb7..a4dcfeba 100644 --- a/manimlib/animation/growing.py +++ b/manimlib/animation/growing.py @@ -32,7 +32,7 @@ class GrowFromCenter(GrowFromPoint): class GrowFromEdge(GrowFromPoint): def __init__(self, mobject, edge, **kwargs): - point = mobject.get_critical_point(edge) + point = mobject.get_bounding_box_point(edge) super().__init__(mobject, point, **kwargs) diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index eee3391b..45091349 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -361,7 +361,7 @@ class Mobject(Container): if about_point is None: if about_edge is None: about_edge = ORIGIN - about_point = self.get_critical_point(about_edge) + about_point = self.get_bounding_box_point(about_edge) for mob in self.family_members_with_points(): mob.points -= about_point mob.points = func(mob.points) @@ -396,7 +396,7 @@ class Mobject(Container): corner in the 2d plane. """ target_point = np.sign(direction) * (FRAME_X_RADIUS, FRAME_Y_RADIUS, 0) - point_to_align = self.get_critical_point(direction) + point_to_align = self.get_bounding_box_point(direction) shift_val = target_point - point_to_align - buff * np.array(direction) shift_val = shift_val * abs(np.sign(direction)) self.shift(shift_val) @@ -422,7 +422,7 @@ class Mobject(Container): target_aligner = mob[index_of_submobject_to_align] else: target_aligner = mob - target_point = target_aligner.get_critical_point( + target_point = target_aligner.get_bounding_box_point( aligned_edge + direction ) else: @@ -433,7 +433,7 @@ class Mobject(Container): aligner = self[index_of_submobject_to_align] else: aligner = self - point_to_align = aligner.get_critical_point(aligned_edge - direction) + point_to_align = aligner.get_bounding_box_point(aligned_edge - direction) self.shift((target_point - point_to_align + buff * direction) * coor_mask) return self @@ -520,10 +520,10 @@ class Mobject(Container): def move_to(self, point_or_mobject, aligned_edge=ORIGIN, coor_mask=np.array([1, 1, 1])): if isinstance(point_or_mobject, Mobject): - target = point_or_mobject.get_critical_point(aligned_edge) + target = point_or_mobject.get_bounding_box_point(aligned_edge) else: target = point_or_mobject - point_to_align = self.get_critical_point(aligned_edge) + point_to_align = self.get_bounding_box_point(aligned_edge) self.shift((target - point_to_align) * coor_mask) return self @@ -733,7 +733,7 @@ class Mobject(Container): else: return np.max(values) - def get_critical_point(self, direction): + def get_bounding_box_point(self, direction): """ Picture a box bounding the mobject. Such a box has 9 'critical points': 4 corners, 4 edge center, the @@ -749,16 +749,16 @@ class Mobject(Container): ) return result - # Pseudonyms for more general get_critical_point method + # Pseudonyms for more general get_bounding_box_point method def get_edge_center(self, direction): - return self.get_critical_point(direction) + return self.get_bounding_box_point(direction) def get_corner(self, direction): - return self.get_critical_point(direction) + return self.get_bounding_box_point(direction) def get_center(self): - return self.get_critical_point(np.zeros(self.dim)) + return self.get_bounding_box_point(np.zeros(self.dim)) def get_center_of_mass(self): return np.apply_along_axis(np.mean, 0, self.get_all_points()) @@ -901,7 +901,7 @@ class Mobject(Container): the center of mob2 """ if isinstance(mobject_or_point, Mobject): - point = mobject_or_point.get_critical_point(direction) + point = mobject_or_point.get_bounding_box_point(direction) else: point = mobject_or_point diff --git a/manimlib/mobject/svg/drawings.py b/manimlib/mobject/svg/drawings.py index 4316d4eb..de51d382 100644 --- a/manimlib/mobject/svg/drawings.py +++ b/manimlib/mobject/svg/drawings.py @@ -467,7 +467,7 @@ class Bubble(SVGMobject): can_flip = not self.direction_was_specified if want_to_flip and can_flip: self.flip() - boundary_point = mobject.get_critical_point(UP - self.direction) + boundary_point = mobject.get_bounding_box_point(UP - self.direction) vector_from_center = 1.0 * (boundary_point - mob_center) self.move_tip_to(mob_center + vector_from_center) return self