A community-maintained Python framework for creating mathematical animations.
Addressed places which depended on rotate being about the origin
Grant Sandersonc5b0e260904a
diff --git a/eop/bayes.py b/eop/bayes.pyindex 0cb25d400..b916f2b6c 100644--- a/eop/bayes.py+++ b/eop/bayes.py@@ -2089,7 +2089,7 @@ class MusicExample(SampleSpaceScene, PiCreatureScene):notes = VGroup(*[note.copy() for x in range(10)])sine_wave = FunctionGraph(np.sin, x_min = -5, x_max = 5)sine_wave.scale(0.75)- sine_wave.rotate(np.pi/6)+ sine_wave.rotate(np.pi/6, about_point = ORIGIN)sine_wave.shift(notes.get_center() - \sine_wave.point_from_proportion(0)diff --git a/eop/bayes_footnote.py b/eop/bayes_footnote.pyindex cdd5e49b7..dd978212a 100644--- a/eop/bayes_footnote.py+++ b/eop/bayes_footnote.py@@ -1348,7 +1348,7 @@ class IntroduceTelepathyExample(StatisticsVsEmpathy):vect[1] = 0arc = Arc(angle = angle)- arc.rotate(-angle/2 + angle_of_vector(vect))+ arc.rotate(-angle/2 + angle_of_vector(vect), about_point = ORIGIN)arc.scale(3)arcs = VGroup(*[arc.copy() for x in range(n_arcs)])arcs.move_to(pi2.eyes.get_center(), vect)diff --git a/eop/independence.py b/eop/independence.pyindex e393263ac..eaabbdef4 100644--- a/eop/independence.py+++ b/eop/independence.py@@ -3072,7 +3072,7 @@ class CorrectForDependence(NameBinomial):for value, alt_value, bar in zip(values, alt_values, bars):arrow = arrow_template.copy()if value < alt_value:- arrow.rotate(np.pi)+ arrow.rotate(np.pi, about_point = ORIGIN)arrow.next_to(bar, UP)arrows.add(arrow)diff --git a/mobject/mobject.py b/mobject/mobject.pyindex 54a23dea4..a68e75e03 100644--- a/mobject/mobject.py+++ b/mobject/mobject.py@@ -248,16 +248,6 @@ class Mobject(object):mob.points += about_pointreturn self- def do_about_point(self, point, method, *args, **kwargs):- self.shift(-point)- method(*args, **kwargs)- self.shift(point)- return self-- def do_in_place(self, method, *args, **kwargs):- self.do_about_point(self.get_center(), method, *args, **kwargs)- return self-def rotate_in_place(self, angle, axis = OUT, axes = []):# redundant with default behavior of rotate now.return self.rotate(angle, axis = axis, axes = axes)@@ -712,7 +702,6 @@ class Mobject(object):"""raise Exception("Not implemented")-def align_points(self, mobject):count1 = self.get_num_points()count2 = mobject.get_num_points()diff --git a/mobject/svg_mobject.py b/mobject/svg_mobject.pyindex 817e3b923..5c237a19a 100644--- a/mobject/svg_mobject.py+++ b/mobject/svg_mobject.py@@ -218,7 +218,7 @@ class VMobjectFromSVGPathstring(VMobject):for command, coord_string in pairs:self.handle_command(command, coord_string)#people treat y-coordinate differently- self.rotate(np.pi, RIGHT)+ self.rotate(np.pi, RIGHT, about_point = ORIGIN)def handle_command(self, command, coord_string):isLower = command.islower()diff --git a/topics/fractals.py b/topics/fractals.pyindex e28f6fee6..c81c52a1d 100644--- a/topics/fractals.py+++ b/topics/fractals.py@@ -127,7 +127,7 @@ class DiamondFractal(SelfSimilarFractal):# VGroup(*subparts).rotate(np.pi/4)for part, vect in zip(subparts, compass_directions(start_vect = UP+RIGHT)):part.next_to(ORIGIN, vect, buff = 0)- VGroup(*subparts).rotate(np.pi/4)+ VGroup(*subparts).rotate(np.pi/4, about_point = ORIGIN)class PentagonalFractal(SelfSimilarFractal):@@ -142,7 +142,7 @@ class PentagonalFractal(SelfSimilarFractal):def arrange_subparts(self, *subparts):for x, part in enumerate(subparts):part.shift(0.95*part.get_height()*UP)- part.rotate(2*np.pi*x/5)+ part.rotate(2*np.pi*x/5, about_point = ORIGIN)class PentagonalPiCreatureFractal(PentagonalFractal):def init_colors(self):@@ -163,7 +163,7 @@ class PentagonalPiCreatureFractal(PentagonalFractal):def arrange_subparts(self, *subparts):for part in subparts:- part.rotate(2*np.pi/5)+ part.rotate(2*np.pi/5, about_point = ORIGIN)PentagonalFractal.arrange_subparts(self, *subparts)@@ -236,7 +236,7 @@ class WonkyHexagonFractal(SelfSimilarFractal):def arrange_subparts(self, *subparts):for i, piece in enumerate(subparts):- piece.rotate(i*np.pi/12)+ piece.rotate(i*np.pi/12, about_point = ORIGIN)p1, p2, p3, p4, p5, p6, p7 = subpartscenter_row = VGroup(p1, p4, p7)center_row.arrange_submobjects(RIGHT, buff = 0)@@ -265,7 +265,7 @@ class CircularFractal(SelfSimilarFractal):ORIGIN, UP,buff = self.height/(2*np.tan(theta)))- part.rotate(i*2*np.pi/self.num_subparts)+ part.rotate(i*2*np.pi/self.num_subparts, about_point = ORIGIN)self.num_subparts -= 1@@ -548,7 +548,7 @@ class FlowSnake(LindenmayerCurve):}def __init__(self, **kwargs):LindenmayerCurve.__init__(self, **kwargs)- self.rotate(-self.order*np.pi/9)+ self.rotate(-self.order*np.pi/9, about_point = ORIGIN)class SierpinskiCurve(LindenmayerCurve):CONFIG = {diff --git a/topics/graph_theory.py b/topics/graph_theory.pyindex 99462995b..bfa53c6d1 100644--- a/topics/graph_theory.py+++ b/topics/graph_theory.py@@ -260,7 +260,7 @@ class GraphScene(Scene):def annotate_edges(self, mobject, fade_in = True, **kwargs):angles = map(np.arctan, map(Line.get_slope, self.edges))self.edge_annotations = [- mobject.copy().rotate(angle).shift(edge.get_center())+ mobject.copy().rotate(angle).move_to(edge.get_center())for angle, edge in zip(angles, self.edges)]if fade_in:diff --git a/topics/number_line.py b/topics/number_line.pyindex 83b6d2cd1..e5ced3475 100644--- a/topics/number_line.py+++ b/topics/number_line.py@@ -169,12 +169,15 @@ class Axes(VGroup):VGroup.__init__(self, **kwargs)self.x_axis = self.get_axis(self.x_min, self.x_max, self.x_axis_config)self.y_axis = self.get_axis(self.y_min, self.y_max, self.y_axis_config)- self.y_axis.rotate(np.pi/2)+ self.y_axis.rotate(np.pi/2, about_point = ORIGIN)self.add(self.x_axis, self.y_axis)if self.three_d:self.z_axis = self.get_axis(self.z_min, self.z_max, self.z_axis_config)- self.z_axis.rotate(-np.pi/2, UP)- self.z_axis.rotate(angle_of_vector(self.z_normal), OUT)+ self.z_axis.rotate(-np.pi/2, UP, about_point = ORIGIN)+ self.z_axis.rotate(+ angle_of_vector(self.z_normal), OUT,+ about_point = ORIGIN+ )self.add(self.z_axis)def get_axis(self, min_val, max_val, extra_config):diff --git a/topics/objects.py b/topics/objects.pyindex 66434722b..c8c4d13a8 100644--- a/topics/objects.py+++ b/topics/objects.py@@ -94,7 +94,7 @@ class Speedometer(VMobject):)needle.stretch_to_fit_width(self.needle_width)needle.stretch_to_fit_height(self.needle_height)- needle.rotate(start_angle - np.pi/2)+ needle.rotate(start_angle - np.pi/2, about_point = ORIGIN)self.add(needle)self.needle = needle@@ -245,8 +245,8 @@ class Laptop(VGroup):self.axis = axisself.add(body, screen_plate, axis)- self.rotate(5*np.pi/12, LEFT)- self.rotate(np.pi/6, DOWN)+ self.rotate(5*np.pi/12, LEFT, about_point = ORIGIN)+ self.rotate(np.pi/6, DOWN, about_point = ORIGIN)class PatreonLogo(SVGMobject):CONFIG = {diff --git a/topics/vector_space_scene.py b/topics/vector_space_scene.pyindex 0e5f6f03f..9c41b62db 100644--- a/topics/vector_space_scene.py+++ b/topics/vector_space_scene.py@@ -104,12 +104,12 @@ class VectorScene(Scene):angle = vector.get_angle()if not rotate:- label.rotate(-angle)+ label.rotate(-angle, about_point = ORIGIN)if direction is "left":label.shift(-label.get_bottom() + 0.1*UP)else:label.shift(-label.get_top() + 0.1*DOWN)- label.rotate(angle)+ label.rotate(angle, about_point = ORIGIN)label.shift((vector.get_end() - vector.get_start())/2)return label