From 55786e443dc7641197fb809306cd9a43a5553ec4 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Fri, 30 Mar 2018 11:03:14 -0700 Subject: [PATCH] Renamed SPACE_WIDTH and SPACE_HEIGHT to SPACE_X_RADIUS and SPACE_Y_RADIUS to be less confusing --- active_projects/eop/bayes_footnote.py | 16 ++-- active_projects/eop/combinations.py | 28 +++---- active_projects/eop/independence.py | 18 ++-- animation/playground.py | 2 +- animation/transform.py | 2 +- camera/camera.py | 16 ++-- constants.py | 12 +-- mobject/mobject.py | 12 +-- old_projects/256.py | 16 ++-- old_projects/WindingNumber.py | 26 +++--- old_projects/WindingNumber_G.py | 30 +++---- old_projects/basel/basel.py | 6 +- old_projects/basel/basel2.py | 38 ++++----- old_projects/bell.py | 20 ++--- old_projects/borsuk.py | 28 +++---- old_projects/brachistochrone/curves.py | 4 +- old_projects/brachistochrone/cycloid.py | 4 +- old_projects/brachistochrone/graveyard.py | 8 +- old_projects/brachistochrone/light.py | 20 ++--- old_projects/brachistochrone/misc.py | 2 +- old_projects/brachistochrone/multilayered.py | 16 ++-- .../complex_multiplication_article.py | 12 +-- old_projects/crypto.py | 42 +++++----- old_projects/domino_play.py | 2 +- old_projects/efvgt.py | 84 +++++++++---------- old_projects/eoc/chapter1.py | 14 ++-- old_projects/eoc/chapter10.py | 24 +++--- old_projects/eoc/chapter2.py | 24 +++--- old_projects/eoc/chapter3.py | 36 ++++---- old_projects/eoc/chapter4.py | 10 +-- old_projects/eoc/chapter5.py | 4 +- old_projects/eoc/chapter6.py | 30 +++---- old_projects/eoc/chapter7.py | 20 ++--- old_projects/eoc/chapter8.py | 6 +- old_projects/eoc/chapter9.py | 14 ++-- old_projects/eoc/footnote.py | 2 +- old_projects/eoc/old_chapter1.py | 14 ++-- old_projects/eola/chapter0.py | 26 +++--- old_projects/eola/chapter1.py | 8 +- old_projects/eola/chapter10.py | 48 +++++------ old_projects/eola/chapter11.py | 60 ++++++------- old_projects/eola/chapter2.py | 24 +++--- old_projects/eola/chapter3.py | 42 +++++----- old_projects/eola/chapter4.py | 16 ++-- old_projects/eola/chapter5.py | 20 ++--- old_projects/eola/chapter6.py | 20 ++--- old_projects/eola/chapter7.py | 56 ++++++------- old_projects/eola/chapter8.py | 22 ++--- old_projects/eola/chapter8p2.py | 30 +++---- old_projects/eola/chapter9.py | 14 ++-- old_projects/eola/footnote.py | 12 +-- old_projects/eola/footnote2.py | 12 +-- old_projects/eola/thumbnails.py | 8 +- old_projects/eulers_characteristic_formula.py | 28 +++---- old_projects/fourier.py | 26 +++--- old_projects/fractal_dimension.py | 68 +++++++-------- old_projects/hanoi.py | 34 ++++---- old_projects/highD.py | 40 ++++----- old_projects/hilbert/section2.py | 16 ++-- old_projects/hilbert/section3.py | 4 +- old_projects/inventing_math.py | 40 ++++----- old_projects/leibniz.py | 40 ++++----- old_projects/matrix_as_transform_2d.py | 20 ++--- old_projects/moser_intro.py | 4 +- old_projects/moser_main.py | 36 ++++---- old_projects/mug.py | 10 +-- old_projects/music_and_measure.py | 26 +++--- old_projects/nn/part1.py | 24 +++--- old_projects/nn/part2.py | 36 ++++---- old_projects/nn/part3.py | 12 +-- old_projects/nn/playground.py | 14 ++-- old_projects/number_line_scene.py | 4 +- old_projects/patreon.py | 8 +- old_projects/pi_day.py | 20 ++--- old_projects/putnam.py | 18 ++-- old_projects/qa_round_two.py | 6 +- old_projects/tattoo.py | 4 +- old_projects/tau_poem.py | 12 +-- old_projects/three_dimensions.py | 2 +- old_projects/triangle_of_power/triangle.py | 2 +- old_projects/triples.py | 32 +++---- old_projects/uncertainty.py | 46 +++++----- old_projects/waves.py | 56 ++++++------- old_projects/zeta.py | 62 +++++++------- scene/moving_camera_scene.py | 2 +- topics/characters.py | 2 +- topics/combinatorics.py | 6 +- topics/common_scenes.py | 12 +-- topics/complex_numbers.py | 4 +- topics/counting.py | 2 +- topics/functions.py | 4 +- topics/geometry.py | 2 +- topics/graph_scene.py | 2 +- topics/graph_theory.py | 6 +- topics/matrix.py | 2 +- topics/number_line.py | 16 ++-- topics/objects.py | 4 +- topics/vector_space_scene.py | 8 +- 98 files changed, 951 insertions(+), 951 deletions(-) diff --git a/active_projects/eop/bayes_footnote.py b/active_projects/eop/bayes_footnote.py index f212be30..0a515f8f 100644 --- a/active_projects/eop/bayes_footnote.py +++ b/active_projects/eop/bayes_footnote.py @@ -271,7 +271,7 @@ class OneInOneThousandHaveDisease(Scene): ]).arrange_submobjects(DOWN, SMALL_BUFF) for x in range(40) ]).arrange_submobjects(RIGHT, SMALL_BUFF) - all_creatures.scale_to_fit_width(2*SPACE_WIDTH - 4) + all_creatures.scale_to_fit_width(2*SPACE_X_RADIUS - 4) all_creatures.next_to(title, DOWN) randy = all_creatures[0][0] all_creatures[0].remove(randy) @@ -444,7 +444,7 @@ class RephraseQuestion(Scene): """, ])) words.arrange_submobjects(RIGHT, buff = LARGE_BUFF) - words.scale_to_fit_width(2*(SPACE_WIDTH - MED_LARGE_BUFF)) + words.scale_to_fit_width(2*(SPACE_X_RADIUS - MED_LARGE_BUFF)) prior = TextMobject("Prior") prior.highlight(GREEN) @@ -872,8 +872,8 @@ class HowMuchCanYouChangeThisPrior(ShowRestrictedSpace, PiCreatureScene): special_group = subgroups[-5] special_group.add(self.sick_one) subgroups.generate_target() - width_factor = 2*SPACE_WIDTH/subgroups.get_width() - height_factor = 2*SPACE_HEIGHT/subgroups.get_height() + width_factor = 2*SPACE_X_RADIUS/subgroups.get_width() + height_factor = 2*SPACE_Y_RADIUS/subgroups.get_height() subgroups.target.stretch_in_place(width_factor, 0) subgroups.target.stretch_in_place(height_factor, 1) for subgroup in subgroups.target: @@ -1369,14 +1369,14 @@ class IntroduceTelepathyExample(StatisticsVsEmpathy): class CompareNumbersInBothExamples(Scene): def construct(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.shift(MED_LARGE_BUFF*LEFT) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.to_edge(UP, buff = 1.25*LARGE_BUFF) titles = VGroup() for word, vect in ("Disease", LEFT), ("Telepathy", RIGHT): title = TextMobject("%s example"%word) - title.shift(vect*SPACE_WIDTH/2.0) + title.shift(vect*SPACE_X_RADIUS/2.0) title.to_edge(UP) titles.add(title) priors = VGroup(*[ @@ -1401,7 +1401,7 @@ class CompareNumbersInBothExamples(Scene): mob.highlight_by_tex("+", GREEN) mob.highlight_by_tex("Correct", GREEN) mob.scale(0.8) - mob.shift(vect*SPACE_WIDTH/2) + mob.shift(vect*SPACE_X_RADIUS/2) self.play( LaggedStart(FadeIn, titles, lag_ratio = 0.7), diff --git a/active_projects/eop/combinations.py b/active_projects/eop/combinations.py index 701f19e5..cdab0156 100644 --- a/active_projects/eop/combinations.py +++ b/active_projects/eop/combinations.py @@ -486,7 +486,7 @@ class SixChooseThreeExample(InitialFiveChooseThreeExample): def talk_through_one_line(self): line = self.stack[8] line.save_state() - distance = SPACE_WIDTH/2 + distance = SPACE_X_RADIUS/2 self.play(line.shift, distance*LEFT) @@ -546,7 +546,7 @@ class SixChooseThreeExample(InitialFiveChooseThreeExample): self.wait() self.play( ApplyMethod( - lhs.shift, 0.65*SPACE_WIDTH*(LEFT+UP), + lhs.shift, 0.65*SPACE_X_RADIUS*(LEFT+UP), path_arc = np.pi/2, rate_func = running_start, remover = True, @@ -618,7 +618,7 @@ class SixChooseThreeInOtherContext(Scene): line = VGroup(*[arrow.tip.copy() for arrow in arrows]) line.arrange_submobjects(RIGHT, buff = 0.5*SMALL_BUFF) if last_line is None: - line.shift(SPACE_WIDTH*RIGHT/2) + line.shift(SPACE_X_RADIUS*RIGHT/2) line.to_edge(UP) self.play( ShowCreation(arrows), @@ -714,7 +714,7 @@ class SixChooseThreeInOtherContext(Scene): # top_stacks.to_edge(UP, buff = MED_SMALL_BUFF) # line = Line(LEFT, RIGHT, color = WHITE) -# line.scale(SPACE_WIDTH) +# line.scale(SPACE_X_RADIUS) # line.next_to(top_stacks, DOWN) # x = TexMobject("x").highlight(BLUE) @@ -834,7 +834,7 @@ class SixChooseThreeInOtherContext(Scene): # y = TexMobject("y").highlight(RED) # stack = get_stack(x, y, n, k) # stack.scale_to_fit_height(self.stack_height) -# stack.shift(SPACE_WIDTH*LEFT/2) +# stack.shift(SPACE_X_RADIUS*LEFT/2) # stack.to_edge(DOWN) # numbers = VGroup(*[ # TexMobject("%d"%(d+1)) @@ -867,7 +867,7 @@ class SixChooseThreeInOtherContext(Scene): # "E", ")" # ) # letters = VGroup(*letter_set[1::2]) -# letter_set.shift(SPACE_WIDTH*RIGHT/2) +# letter_set.shift(SPACE_X_RADIUS*RIGHT/2) # letter_set.to_edge(UP) # letter_subsets = list(it.combinations(letters, k)) @@ -878,7 +878,7 @@ class SixChooseThreeInOtherContext(Scene): # for letter_subset in letter_subsets # ]).arrange_submobjects(DOWN, buff = MED_SMALL_BUFF) # subset_mobs.scale_to_fit_height(self.stack_height) -# subset_mobs.shift(SPACE_WIDTH*RIGHT/2) +# subset_mobs.shift(SPACE_X_RADIUS*RIGHT/2) # subset_mobs.to_edge(DOWN) # choose_words = TextMobject("Choose %d"%k) @@ -1530,7 +1530,7 @@ class BuildFiveFromFour(ProbabilityOfKWomenInGroupOfFive): top_stacks = bottom_stacks.deepcopy() top_group = VGroup(top_stacks, top_stacks.numbers) - h_line = DashedLine(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + h_line = DashedLine(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) #Initial split self.play( @@ -1667,8 +1667,8 @@ class BuildUpFromStart(Scene): stacks.arrange_submobjects(RIGHT, buff = LARGE_BUFF) stacks.numbers = self.get_numbers(stacks) - max_width = 2*SPACE_WIDTH - 3 - max_height = SPACE_HEIGHT - 1 + max_width = 2*SPACE_X_RADIUS - 3 + max_height = SPACE_Y_RADIUS - 1 self.add(stacks, stacks.numbers) for x in range(self.n_iterations): @@ -2021,7 +2021,7 @@ class IntroducePascalsTriangle(Scene): if n == 0: line.add(Line(LEFT, RIGHT).scale(0.1).set_stroke(BLACK, 0)) line.arrange_submobjects(RIGHT, SMALL_BUFF) - line.shift(SPACE_WIDTH*RIGHT/2 + SPACE_HEIGHT*UP/2) + line.shift(SPACE_X_RADIUS*RIGHT/2 + SPACE_Y_RADIUS*UP/2) brace = Brace(line, UP) if n == 1: label = "1 Person" @@ -2066,8 +2066,8 @@ class StacksApproachBellCurve(Scene): numbers = VGroup(Integer(1)) numbers.next_to(bars, UP, SMALL_BUFF) - max_width = 2*SPACE_WIDTH - 2 - max_height = SPACE_HEIGHT - 1.5 + max_width = 2*SPACE_X_RADIUS - 2 + max_height = SPACE_Y_RADIUS - 1.5 for x in range(self.n_iterations): if x == 0: @@ -3300,7 +3300,7 @@ class ABCNotBCA(Scene): equation.highlight(YELLOW) equation.next_to(words, DOWN) group = VGroup(words, equation) - group.scale_to_fit_width(2*SPACE_WIDTH - 1) + group.scale_to_fit_width(2*SPACE_X_RADIUS - 1) group.to_edge(DOWN) self.add(words, equation) diff --git a/active_projects/eop/independence.py b/active_projects/eop/independence.py index 0cc28aec..b488c3e8 100644 --- a/active_projects/eop/independence.py +++ b/active_projects/eop/independence.py @@ -93,7 +93,7 @@ def get_slot_group( slot_group.to_edge(RIGHT) slot_group.bool_list = bool_list - total_height = SPACE_HEIGHT + total_height = SPACE_Y_RADIUS base = 2.3 for i, line in enumerate(lines): @@ -1256,7 +1256,7 @@ class ExampleConditional(Scene): rhs.highlight_by_tex("0.925", YELLOW) rhs.next_to(prob, RIGHT) expression = VGroup(prob, rhs) - expression.scale_to_fit_width(2*SPACE_WIDTH - 1) + expression.scale_to_fit_width(2*SPACE_X_RADIUS - 1) expression.center().to_edge(DOWN) self.play(Write(expression)) @@ -1296,7 +1296,7 @@ class WritePSecond(Scene): rhs = TexMobject("= 0.8") rhs.next_to(prob, RIGHT) prob.add(rhs) - prob.scale_to_fit_width(2*SPACE_WIDTH - 1) + prob.scale_to_fit_width(2*SPACE_X_RADIUS - 1) prob.center().to_edge(DOWN) self.play(Write(prob)) @@ -1833,7 +1833,7 @@ class ShowFullDistribution(Scene): "P(", "\\text{Correct}", ")", "=", "0.8" ) new_prob.highlight_by_tex("Correct", GREEN) - new_prob.shift(SPACE_WIDTH*RIGHT/2) + new_prob.shift(SPACE_X_RADIUS*RIGHT/2) new_prob.to_edge(UP) alt_ps = 0.5, 0.65, 0.25 @@ -2538,7 +2538,7 @@ class CycleThroughPatterns(NameBinomial): ) question.highlight_by_tex("male", BLUE) question.highlight_by_tex("female", MAROON_B) - question.scale_to_fit_width(2*SPACE_WIDTH - 1) + question.scale_to_fit_width(2*SPACE_X_RADIUS - 1) question.to_edge(UP, buff = LARGE_BUFF) self.add(question) @@ -3200,7 +3200,7 @@ class AssumeOrderDoesntMatter(Scene): equals.next_to(prob, RIGHT) prob.add(equals) prob_group.arrange_submobjects(RIGHT) - max_width = 2*SPACE_WIDTH - 1 + max_width = 2*SPACE_X_RADIUS - 1 if prob_group.get_width() > max_width: prob_group.scale_to_fit_width(max_width) prob_groups.arrange_submobjects(DOWN, buff = 0.7) @@ -3244,7 +3244,7 @@ class AssumeOrderDoesntMatter(Scene): self.play( LaggedStart( ApplyMethod, self.assumption_group, - lambda m : (m.shift, 2*SPACE_HEIGHT*DOWN), + lambda m : (m.shift, 2*SPACE_Y_RADIUS*DOWN), remover = True, ), ApplyMethod( @@ -3553,8 +3553,8 @@ class Thumbnail(DangerInProbability): chart = BarChart( values = values, label_y_axis = False, - width = 2*SPACE_WIDTH - 3, - height = 1.5*SPACE_HEIGHT + width = 2*SPACE_X_RADIUS - 3, + height = 1.5*SPACE_Y_RADIUS ) chart.to_edge(DOWN) self.add(chart) diff --git a/animation/playground.py b/animation/playground.py index 34e10a39..ccf894d9 100644 --- a/animation/playground.py +++ b/animation/playground.py @@ -14,7 +14,7 @@ class Vibrate(Animation): "temporal_period" : 1, "overtones" : 4, "amplitude" : 0.5, - "radius" : SPACE_WIDTH/2, + "radius" : SPACE_X_RADIUS/2, "run_time" : 3.0, "rate_func" : None } diff --git a/animation/transform.py b/animation/transform.py index ec0cb1f0..d42515eb 100644 --- a/animation/transform.py +++ b/animation/transform.py @@ -193,7 +193,7 @@ class FocusOn(Transform): def __init__(self, mobject_or_point, **kwargs): digest_config(self, kwargs) big_dot = Dot( - radius = SPACE_WIDTH+SPACE_HEIGHT, + radius = SPACE_X_RADIUS+SPACE_Y_RADIUS, stroke_width = 0, fill_color = self.color, fill_opacity = 0, diff --git a/camera/camera.py b/camera/camera.py index 80c067fc..c1679afb 100644 --- a/camera/camera.py +++ b/camera/camera.py @@ -22,15 +22,15 @@ class Camera(object): # Note 2: While pixel_shape indicates the actual full height # and width of the pixel array, space_shape indicates only # half the height and half the width of space (extending from - # -space_height to +space_height vertically and from - # -space_widtdh to +space_width horizontally) + # -SPACE_Y_RADIUS to +SPACE_Y_RADIUS vertically and from + # -SPACE_X_RADIUS to +SPACE_X_RADIUS horizontally) # TODO: Rename these to SPACE_X_RADIUS, SPACE_Y_RADIUS - "space_shape" : (SPACE_HEIGHT, SPACE_WIDTH), + "space_shape" : (SPACE_Y_RADIUS, SPACE_X_RADIUS), "space_center" : ORIGIN, "background_color" : BLACK, #Points in vectorized mobjects with norm greater #than this value will be rescaled. - "max_allowable_norm" : 2*SPACE_WIDTH, + "max_allowable_norm" : 2*SPACE_X_RADIUS, "image_mode" : "RGBA", "n_rgb_coords" : 4, "background_alpha" : 0, #Out of rgb_max_val @@ -63,12 +63,12 @@ class Camera(object): remains fixed while the other changes accordingly. """ aspect_ratio = float(self.pixel_shape[1])/self.pixel_shape[0] - space_height, space_width = self.space_shape + space_y_radius, space_y_radius = self.space_shape if fixed_dimension == 0: - space_width = aspect_ratio*space_height + space_y_radius = aspect_ratio*space_y_radius else: - space_height = space_width/aspect_ratio - self.space_shape = (space_height, space_width) + space_y_radius = space_y_radius/aspect_ratio + self.space_shape = (space_y_radius, space_y_radius) def init_background(self): if self.background_image is not None: diff --git a/constants.py b/constants.py index cac15811..b5dde48e 100644 --- a/constants.py +++ b/constants.py @@ -27,8 +27,8 @@ DEFAULT_POINT_DENSITY_1D = 250 DEFAULT_POINT_THICKNESS = 4 #TODO, Make sure these are not needed -SPACE_HEIGHT = 4.0 -SPACE_WIDTH = SPACE_HEIGHT * DEFAULT_WIDTH / DEFAULT_HEIGHT +SPACE_Y_RADIUS = 4.0 +SPACE_X_RADIUS = SPACE_Y_RADIUS * DEFAULT_WIDTH / DEFAULT_HEIGHT SMALL_BUFF = 0.1 @@ -57,10 +57,10 @@ X_AXIS = np.array(( 1., 0., 0.)) Y_AXIS = np.array(( 0., 1., 0.)) Z_AXIS = np.array(( 0., 0., 1.)) -TOP = SPACE_HEIGHT*UP -BOTTOM = SPACE_HEIGHT*DOWN -LEFT_SIDE = SPACE_WIDTH*LEFT -RIGHT_SIDE = SPACE_WIDTH*RIGHT +TOP = SPACE_Y_RADIUS*UP +BOTTOM = SPACE_Y_RADIUS*DOWN +LEFT_SIDE = SPACE_X_RADIUS*LEFT +RIGHT_SIDE = SPACE_X_RADIUS*RIGHT TAU = 2*np.pi DEGREES = TAU/360 diff --git a/mobject/mobject.py b/mobject/mobject.py index 2deaeeb5..e8418823 100644 --- a/mobject/mobject.py +++ b/mobject/mobject.py @@ -277,7 +277,7 @@ class Mobject(Container): Direction just needs to be a vector pointing towards side or corner in the 2d plane. """ - target_point = np.sign(direction) * (SPACE_WIDTH, SPACE_HEIGHT, 0) + target_point = np.sign(direction) * (SPACE_X_RADIUS, SPACE_Y_RADIUS, 0) point_to_align = self.get_critical_point(direction) shift_val = target_point - point_to_align - buff * np.array(direction) shift_val = shift_val * abs(np.sign(direction)) @@ -345,7 +345,7 @@ class Mobject(Container): return self def shift_onto_screen(self, **kwargs): - space_lengths = [SPACE_WIDTH, SPACE_HEIGHT] + space_lengths = [SPACE_X_RADIUS, SPACE_Y_RADIUS] for vect in UP, DOWN, LEFT, RIGHT: dim = np.argmax(np.abs(vect)) buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_EDGE_BUFFER) @@ -356,13 +356,13 @@ class Mobject(Container): return self def is_off_screen(self): - if self.get_left()[0] > SPACE_WIDTH: + if self.get_left()[0] > SPACE_X_RADIUS: return True - if self.get_right()[0] < -SPACE_WIDTH: + if self.get_right()[0] < -SPACE_X_RADIUS: return True - if self.get_bottom()[1] > SPACE_HEIGHT: + if self.get_bottom()[1] > SPACE_Y_RADIUS: return True - if self.get_top()[1] < -SPACE_HEIGHT: + if self.get_top()[1] < -SPACE_Y_RADIUS: return True return False diff --git a/old_projects/256.py b/old_projects/256.py index 3e13551b..67faa509 100644 --- a/old_projects/256.py +++ b/old_projects/256.py @@ -169,7 +169,7 @@ class BreakUp2To256(PiCreatureScene): ]) target.arrange_submobjects(RIGHT, buff = SMALL_BUFF) target.to_edge(UP) - target.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + target.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) parens = VGroup(*it.chain(*[ [t[0], t[2]] for t in target ])) @@ -240,7 +240,7 @@ class MainBreakdown(Scene): top_line.add(mob) four_billions.add(mob[1]) top_line.arrange_submobjects(RIGHT, buff = SMALL_BUFF) - top_line.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + top_line.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) top_line.to_edge(UP) four_billions.highlight(YELLOW) self.add(top_line) @@ -596,8 +596,8 @@ class MainBreakdown(Scene): group.add(dots) group.add(*[group[0].copy() for x in range(2)]) group.arrange_submobjects(RIGHT, buff = SMALL_BUFF) - group.scale_to_fit_height(SPACE_HEIGHT) - max_width = 1.25*SPACE_WIDTH + group.scale_to_fit_height(SPACE_Y_RADIUS) + max_width = 1.25*SPACE_X_RADIUS if group.get_width() > max_width: group.scale_to_fit_width(max_width) group.to_corner(DOWN+RIGHT) @@ -722,7 +722,7 @@ class StateOfBitcoin(TeacherStudentsScene): height = 1, fill_color = LIGHT_GREY, ) - gpu.shift(0.5*SPACE_WIDTH*RIGHT) + gpu.shift(0.5*SPACE_X_RADIUS*RIGHT) gpu_name = TextMobject("GPU") gpu_name.highlight(BLUE) gpu_name.next_to(gpu, UP) @@ -843,7 +843,7 @@ class QAndA(PiCreatureScene): ]).arrange_submobjects(DOWN, buff = SMALL_BUFF) for y in range(cols) ]).arrange_submobjects(RIGHT, buff = SMALL_BUFF) - dots.scale_to_fit_width(2*SPACE_WIDTH - 2*LARGE_BUFF) + dots.scale_to_fit_width(2*SPACE_X_RADIUS - 2*LARGE_BUFF) dots.next_to(self.pi_creature, UP) dots = VGroup(*it.chain(*dots)) top = dots.get_top() @@ -900,12 +900,12 @@ class Thumbnail(Scene): if i%(n_chars/4) == 0: new_str += " \\\\ " background_num = TexMobject(new_str) - background_num.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + background_num.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) background_num.set_fill(opacity = 0.2) secure = TextMobject("Secure?") secure.scale(4) - secure.shift(SPACE_HEIGHT*DOWN/2) + secure.shift(SPACE_Y_RADIUS*DOWN/2) secure.highlight(RED) secure.set_stroke(RED_A, 3) diff --git a/old_projects/WindingNumber.py b/old_projects/WindingNumber.py index ef04b08d..36db12ed 100644 --- a/old_projects/WindingNumber.py +++ b/old_projects/WindingNumber.py @@ -359,7 +359,7 @@ class EquationSolver1d(GraphScene, ZoomedScene): x_guess_label_caption = TextMobject("New guess: x = ", fill_color = midColor) x_guess_label_num = DecimalNumber(midX, fill_color = midColor) - x_guess_label_num.move_to(0.9 * SPACE_HEIGHT * DOWN) + x_guess_label_num.move_to(0.9 * SPACE_Y_RADIUS * DOWN) x_guess_label_caption.next_to(x_guess_label_num, LEFT) x_guess_label = Group(x_guess_label_caption, x_guess_label_num) y_guess_label_caption = TextMobject(", y = ", fill_color = midColor) @@ -492,7 +492,7 @@ def plane_zeta((x, y)): return (float(answer.real), float(answer.imag)) def rescaled_plane_zeta((x, y)): - return plane_zeta((x/SPACE_WIDTH, 8*y)) + return plane_zeta((x/SPACE_X_RADIUS, 8*y)) # Returns a function from 2-ples to 2-ples # This function is specified by a list of (x, y, z) tuples, @@ -1558,8 +1558,8 @@ class VectorField(Scene): num_plane = NumberPlane() self.add(num_plane) - x_min, y_min = num_plane.point_to_coords(SPACE_WIDTH * LEFT + SPACE_HEIGHT * UP) - x_max, y_max = num_plane.point_to_coords(SPACE_WIDTH * RIGHT + SPACE_HEIGHT * DOWN) + x_min, y_min = num_plane.point_to_coords(SPACE_X_RADIUS * LEFT + SPACE_Y_RADIUS * UP) + x_max, y_max = num_plane.point_to_coords(SPACE_X_RADIUS * RIGHT + SPACE_Y_RADIUS * DOWN) x_points = np.linspace(x_min, x_max, self.granularity) y_points = np.linspace(y_min, y_max, self.granularity) @@ -1791,17 +1791,17 @@ class Initial2dFuncSceneMorphing(Initial2dFuncSceneBase): } def setup(self): - split_line = DashedLine(SPACE_HEIGHT * UP, SPACE_HEIGHT * DOWN) - self.num_plane = NumberPlane(x_radius = SPACE_WIDTH/2) + split_line = DashedLine(SPACE_Y_RADIUS * UP, SPACE_Y_RADIUS * DOWN) + self.num_plane = NumberPlane(x_radius = SPACE_X_RADIUS/2) self.num_plane.to_edge(LEFT, buff = 0) self.num_plane.prepare_for_nonlinear_transform() self.add(self.num_plane, split_line) def squash_onto_left(self, object): - object.shift(SPACE_WIDTH/2 * LEFT) + object.shift(SPACE_X_RADIUS/2 * LEFT) def squash_onto_right(self, object): - object.shift(SPACE_WIDTH/2 * RIGHT) + object.shift(SPACE_X_RADIUS/2 * RIGHT) def obj_draw(self, input_object): output_object = input_object.copy() @@ -1820,10 +1820,10 @@ class Initial2dFuncSceneMorphing(Initial2dFuncSceneBase): right_plane.center() right_plane.prepare_for_nonlinear_transform() right_plane.apply_function(self.func) - right_plane.shift(SPACE_WIDTH/2 * RIGHT) + right_plane.shift(SPACE_X_RADIUS/2 * RIGHT) self.right_plane = right_plane crappy_cropper = FullScreenFadeRectangle(fill_opacity = 1) - crappy_cropper.stretch_to_fit_width(SPACE_WIDTH) + crappy_cropper.stretch_to_fit_width(SPACE_X_RADIUS) crappy_cropper.to_edge(LEFT, buff = 0) self.play( ReplacementTransform(self.num_plane.copy(), right_plane), @@ -1847,7 +1847,7 @@ class DemonstrateColorMapping(ColorMappedObjectsScene): # self.add_foreground_mobject(output_plane_label) if self.show_full_color_map: - bright_background = Rectangle(width = 2 * SPACE_WIDTH + 1, height = 2 * SPACE_HEIGHT + 1, fill_opacity = 1) + bright_background = Rectangle(width = 2 * SPACE_X_RADIUS + 1, height = 2 * SPACE_Y_RADIUS + 1, fill_opacity = 1) bright_background.color_using_background_image(self.background_image_file) dim_background = bright_background.copy() dim_background.fill_opacity = 0.3 @@ -2711,10 +2711,10 @@ class NotFoundScene(Scene): self.wait() criticalStripYScale = 100 -criticalStrip = Axes(x_min = -0.5, x_max = 1.5, x_axis_config = {"unit_size" : SPACE_WIDTH, +criticalStrip = Axes(x_min = -0.5, x_max = 1.5, x_axis_config = {"unit_size" : SPACE_X_RADIUS, "number_at_center" : 0.5}, y_min = -criticalStripYScale, y_max = criticalStripYScale, - y_axis_config = {"unit_size" : fdiv(SPACE_HEIGHT, criticalStripYScale)}) + y_axis_config = {"unit_size" : fdiv(SPACE_Y_RADIUS, criticalStripYScale)}) class ZetaViz(PureColorMap): CONFIG = { diff --git a/old_projects/WindingNumber_G.py b/old_projects/WindingNumber_G.py index 89969d0f..24675f8b 100644 --- a/old_projects/WindingNumber_G.py +++ b/old_projects/WindingNumber_G.py @@ -718,7 +718,7 @@ class RewriteEquationWithTeacher(AltTeacherStudentsScene): self.play( ApplyMethod( - to_remove.next_to, SPACE_WIDTH*RIGHT, RIGHT, + to_remove.next_to, SPACE_X_RADIUS*RIGHT, RIGHT, remover = True, rate_func = running_start, path_arc = -TAU/4, @@ -740,7 +740,7 @@ class InputOutputScene(Scene): CONFIG = { "plane_width" : 6, "plane_height" : 6, - "x_shift" : SPACE_WIDTH/2, + "x_shift" : SPACE_X_RADIUS/2, "y_shift" : MED_LARGE_BUFF, "output_scalar" : 10, "non_renormalized_func" : plane_func_by_wind_spec( @@ -813,7 +813,7 @@ class InputOutputScene(Scene): plane.add_coordinates(x_vals = range(-2, 3), y_vals = range(-2, 3)) plane.white_parts = VGroup(plane.axes, plane.coordinate_labels) plane.lines_to_fade = VGroup(plane.main_lines, plane.secondary_lines) - plane.move_to(vect*SPACE_WIDTH/2 + self.y_shift*DOWN) + plane.move_to(vect*SPACE_X_RADIUS/2 + self.y_shift*DOWN) label = TextMobject(text) label.scale(1.5) label.add_background_rectangle() @@ -828,7 +828,7 @@ class InputOutputScene(Scene): return planes def get_v_line(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.set_stroke(WHITE, 5) return v_line @@ -1160,7 +1160,7 @@ class TwoDScreenInOurThreeDWorld(AltTeacherStudentsScene, ThreeDScene): laptop.rotate(-TAU/12, DOWN) laptop.rotate(-5*TAU/24, LEFT) laptop.rotate(TAU/8, LEFT) - laptop.scale(2.3*SPACE_WIDTH/laptop.screen_plate.get_width()) + laptop.scale(2.3*SPACE_X_RADIUS/laptop.screen_plate.get_width()) laptop.shift(-laptop.screen_plate.get_center() + 0.1*IN) should_shade_in_3d(laptop) @@ -1208,8 +1208,8 @@ class EveryOutputPointHasAColor(ColorMappedObjectsScene): dots = VGroup() step = self.dot_spacing - for x in np.arange(-SPACE_WIDTH, SPACE_WIDTH+step, step): - for y in np.arange(-SPACE_HEIGHT, SPACE_HEIGHT+step, step): + for x in np.arange(-SPACE_X_RADIUS, SPACE_X_RADIUS+step, step): + for y in np.arange(-SPACE_Y_RADIUS, SPACE_Y_RADIUS+step, step): dot = Dot(color = WHITE) dot.color_using_background_image(self.background_image_file) dot.move_to(x*RIGHT + y*UP) @@ -1242,8 +1242,8 @@ class DotsHoppingToColor(InputOutputScene): dots = self.get_dots(input_plane, output_plane) right_half_block = Rectangle( - height = 2*SPACE_HEIGHT, - width = SPACE_WIDTH - SMALL_BUFF, + height = 2*SPACE_Y_RADIUS, + width = SPACE_X_RADIUS - SMALL_BUFF, stroke_width = 0, fill_color = BLACK, fill_opacity = 0.8, @@ -1292,7 +1292,7 @@ class DotsHoppingToColor(InputOutputScene): #Cover output half right_half_block.save_state() - right_half_block.next_to(SPACE_WIDTH*RIGHT, RIGHT) + right_half_block.next_to(SPACE_X_RADIUS*RIGHT, RIGHT) self.play(right_half_block.restore) self.wait() @@ -1333,7 +1333,7 @@ class DotsHoppingToColor(InputOutputScene): Write(pink_points_label) ) self.wait() - self.play(right_half_block.next_to, SPACE_WIDTH*RIGHT, RIGHT) + self.play(right_half_block.next_to, SPACE_X_RADIUS*RIGHT, RIGHT) inspector_image_update_anim.update(0) self.play(ReplacementTransform( inspector.copy(), inspector_image, @@ -1827,7 +1827,7 @@ class ForeverNarrowingLoop(InputOutputScene): plane.white_parts.highlight(BLACK) plane.lines_to_fade.set_stroke(width = 0) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.set_stroke(WHITE, 5) self.add(colorings, v_line, planes) @@ -2095,7 +2095,7 @@ class PathContainingZero(InputOutputScene, PiCreatureScene): # plane.white_parts.highlight(BLACK) plane.lines_to_fade.set_stroke(width = 0) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.set_stroke(WHITE, 5) self.add(colorings, planes) @@ -2931,7 +2931,7 @@ class AllOfTheVideos(Scene): rect.set_stroke(WHITE, 1) image.add(rect) images.arrange_submobjects_in_grid(n, n, buff = 0) - images.scale_to_fit_height(2*SPACE_HEIGHT) + images.scale_to_fit_height(2*SPACE_Y_RADIUS) random.shuffle(images.submobjects) self.play(LaggedStart(FadeIn, images, run_time = 4)) @@ -2995,7 +2995,7 @@ class TickingClock(Scene): } def construct(self): clock = Clock() - clock.scale_to_fit_height(2*SPACE_HEIGHT - 1) + clock.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) clock.to_edge(LEFT) lines = [clock.hour_hand, clock.minute_hand] def update_line(line): diff --git a/old_projects/basel/basel.py b/old_projects/basel/basel.py index ece1b189..767a9655 100644 --- a/old_projects/basel/basel.py +++ b/old_projects/basel/basel.py @@ -2078,7 +2078,7 @@ class IPTScene1(PiCreatureScene): # use the following for the zoomed inset if show_detail: - self.camera.space_shape = (0.02 * SPACE_HEIGHT, 0.02 * SPACE_WIDTH) + self.camera.space_shape = (0.02 * SPACE_Y_RADIUS, 0.02 * SPACE_X_RADIUS) self.camera.space_center = C SCREEN_SCALE = 0.01 SCREEN_THICKNESS = 0.02 @@ -3873,8 +3873,8 @@ class PondScene(ThreeDScene): covering_rectangle = Rectangle( - width = SPACE_WIDTH * scale, - height = 2 * SPACE_HEIGHT * scale, + width = SPACE_X_RADIUS * scale, + height = 2 * SPACE_Y_RADIUS * scale, stroke_width = 0, fill_color = BLACK, fill_opacity = 1, diff --git a/old_projects/basel/basel2.py b/old_projects/basel/basel2.py index f940c8c6..5df933a9 100644 --- a/old_projects/basel/basel2.py +++ b/old_projects/basel/basel2.py @@ -504,8 +504,8 @@ class IntroScene(PiCreatureScene): euler_words.next_to(euler, DOWN) euler.add(euler_words) - pietro.next_to(SPACE_WIDTH*LEFT, LEFT) - euler.next_to(SPACE_WIDTH*RIGHT, RIGHT) + pietro.next_to(SPACE_X_RADIUS*LEFT, LEFT) + euler.next_to(SPACE_X_RADIUS*RIGHT, RIGHT) pi_answer = self.pi_answer = TexMobject("{\\pi^2 \\over 6}") pi_answer.highlight(YELLOW) @@ -519,7 +519,7 @@ class IntroScene(PiCreatureScene): pi = pi_answer[0] pi_rect = SurroundingRectangle(pi, color = RED) pi_rect.save_state() - pi_rect.scale_to_fit_height(SPACE_HEIGHT) + pi_rect.scale_to_fit_height(SPACE_Y_RADIUS) pi_rect.center() pi_rect.set_stroke(width = 0) squared = pi_answer[1] @@ -534,7 +534,7 @@ class IntroScene(PiCreatureScene): self.number_line_group.save_state() self.play( pietro.next_to, ORIGIN, LEFT, LARGE_BUFF, - self.number_line_group.next_to, SPACE_HEIGHT*DOWN, DOWN, + self.number_line_group.next_to, SPACE_Y_RADIUS*DOWN, DOWN, morty.change, "pondering", ) self.wait(2) @@ -762,7 +762,7 @@ class MathematicalWebOfConnections(PiCreatureScene): semi_circle.highlight(YELLOW) VGroup(radius, semi_circle).move_to( - SPACE_WIDTH*LEFT/2 + SPACE_HEIGHT*UP/2, + SPACE_X_RADIUS*LEFT/2 + SPACE_Y_RADIUS*UP/2, ) decimal = DecimalNumber(0) @@ -795,7 +795,7 @@ class MathematicalWebOfConnections(PiCreatureScene): ) to_shift_down.generate_target() for part in to_shift_down.target: - part.move_to(2*SPACE_HEIGHT*DOWN) + part.move_to(2*SPACE_Y_RADIUS*DOWN) basel_sum = self.formulas[0] @@ -917,8 +917,8 @@ class MathematicalWebOfConnections(PiCreatureScene): def create_pi_creatures(self): jerk = PiCreature(color = GREEN_D) randy = Randolph().flip() - jerk.move_to(0.5*SPACE_WIDTH*LEFT).to_edge(DOWN) - randy.move_to(0.5*SPACE_WIDTH*RIGHT).to_edge(DOWN) + jerk.move_to(0.5*SPACE_X_RADIUS*LEFT).to_edge(DOWN) + randy.move_to(0.5*SPACE_X_RADIUS*RIGHT).to_edge(DOWN) return VGroup(jerk, randy) @@ -1431,7 +1431,7 @@ class EarthScene(IntroduceScreen): CONFIG = { "screen_height" : 0.5, "screen_thickness" : 0, - "radius" : 100 + SPACE_WIDTH, + "radius" : 100 + SPACE_X_RADIUS, "source_point" : 100*LEFT, "min_ray_angle" : -1.65*DEGREES, "max_ray_angle" : 1.65*DEGREES, @@ -1446,7 +1446,7 @@ class EarthScene(IntroduceScreen): earth.replace(earth_circle) black_rect = Rectangle( - height = 2*SPACE_HEIGHT, + height = 2*SPACE_Y_RADIUS, width = earth_radius + LARGE_BUFF, stroke_width = 0, fill_color = BLACK, @@ -1906,7 +1906,7 @@ class OtherInstanceOfInverseSquareLaw(Scene): def construct(self): title = TextMobject("Where the inverse square law shows up") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title, h_line) @@ -1938,7 +1938,7 @@ class OtherInstanceOfInverseSquareLaw(Scene): class ScreensIntroWrapper(TeacherStudentsScene): def construct(self): - point = VectorizedPoint(SPACE_WIDTH*LEFT/2 + SPACE_HEIGHT*UP/2) + point = VectorizedPoint(SPACE_X_RADIUS*LEFT/2 + SPACE_Y_RADIUS*UP/2) self.play(self.teacher.change, "raise_right_hand") self.change_student_modes( "pondering", "erm", "confused", @@ -2359,12 +2359,12 @@ class MathologerVideoWrapper(Scene): logo = ImageMobject("mathologer_logo") logo.scale_to_fit_height(1) logo.to_corner(UP+LEFT) - logo.shift(2*SPACE_WIDTH*RIGHT) + logo.shift(2*SPACE_X_RADIUS*RIGHT) screen = ScreenRectangle(height = 5.5) screen.next_to(title, DOWN) self.play( - logo.shift, 2*SPACE_WIDTH*LEFT, + logo.shift, 2*SPACE_X_RADIUS*LEFT, LaggedStart(FadeIn, title), run_time = 2 ) @@ -2458,7 +2458,7 @@ class SimpleIPTProof(Scene): class WeCanHaveMoreFunThanThat(TeacherStudentsScene): def construct(self): - point = VectorizedPoint(SPACE_WIDTH*LEFT/2 + SPACE_HEIGHT*UP/2) + point = VectorizedPoint(SPACE_X_RADIUS*LEFT/2 + SPACE_Y_RADIUS*UP/2) self.teacher_says( "We can have \\\\ more fun than that!", target_mode = "hooray" @@ -3729,8 +3729,8 @@ class PondScene(ThreeDScene): self.wait() covering_rectangle = Rectangle( - width = SPACE_WIDTH * scale, - height = 2 * SPACE_HEIGHT * scale, + width = SPACE_X_RADIUS * scale, + height = 2 * SPACE_Y_RADIUS * scale, stroke_width = 0, fill_color = BLACK, fill_opacity = 1, @@ -3786,14 +3786,14 @@ class CenterOfLargerCircleOverlayText(Scene): arrow = Vector(DOWN+LEFT, color = WHITE) arrow.shift(words.get_bottom() + SMALL_BUFF*DOWN - arrow.get_start()) group = VGroup(words, arrow) - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) group.to_edge(UP) self.add(group) class DiameterWordOverlay(Scene): def construct(self): word = TextMobject("Diameter") - word.scale_to_fit_width(SPACE_WIDTH) + word.scale_to_fit_width(SPACE_X_RADIUS) word.rotate(-45*DEGREES) self.play(Write(word)) self.wait() diff --git a/old_projects/bell.py b/old_projects/bell.py index 14f5b035..2061a2ad 100644 --- a/old_projects/bell.py +++ b/old_projects/bell.py @@ -44,7 +44,7 @@ class PhotonPassesCompletelyOrNotAtAll(DirectionOfPolarizationScene): "EMWave_config" : { "wave_number" : 0, "A_vect" : [0, 1, 1], - "start_point" : SPACE_WIDTH*LEFT + DOWN + 1.5*OUT, + "start_point" : SPACE_X_RADIUS*LEFT + DOWN + 1.5*OUT, }, "start_theta" : -0.9*np.pi, "target_theta" : -0.6*np.pi, @@ -168,7 +168,7 @@ class PhotonsThroughPerpendicularFilters(PhotonPassesCompletelyOrNotAtAll): "target_theta" : -0.6*np.pi, "EMWave_config" : { "A_vect" : [0, 0, 1], - "start_point" : SPACE_WIDTH*LEFT + DOWN + OUT, + "start_point" : SPACE_X_RADIUS*LEFT + DOWN + OUT, }, "apply_filter" : False, } @@ -216,7 +216,7 @@ class PhotonsThroughPerpendicularFilters(PhotonPassesCompletelyOrNotAtAll): self.continual_update() return [ WavePacket( - filter_distance = SPACE_WIDTH + x, + filter_distance = SPACE_X_RADIUS + x, get_filtered = True, em_wave = self.em_wave.copy(), run_time = 1, @@ -569,9 +569,9 @@ class AngleToProbabilityChart(Scene): ) right_title.next_to(left_title, RIGHT, LARGE_BUFF) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.to_edge(UP, buff = 2) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.next_to(left_title, RIGHT, MED_LARGE_BUFF) v_line.to_edge(UP, buff = 0) VGroup(h_line, v_line).highlight(BLUE) @@ -690,7 +690,7 @@ class ShowVariousFilterPairsWithPhotonsOverTime(PhotonsThroughPerpendicularFilte lambda x : x, 0.5, 1 ) added_anims = [] - if photon.filter_distance == SPACE_WIDTH + 2: + if photon.filter_distance == SPACE_X_RADIUS + 2: absorption = self.get_filter_absorption_animation( self.second_filter, photon ) @@ -929,7 +929,7 @@ class ForgetPreviousActions(ShowVariousFilterPairs): "start_theta" : -0.6*np.pi, "EMWave_config" : { "wave_number" : 0, - "start_point" : SPACE_WIDTH*LEFT + DOWN, + "start_point" : SPACE_X_RADIUS*LEFT + DOWN, }, "apply_filter" : False, } @@ -1012,7 +1012,7 @@ class ForgetPreviousActions(ShowVariousFilterPairs): def shoot_photon(self): photon = random.choice(self.photons) added_anims = [] - if photon.filter_distance == SPACE_WIDTH + 2: + if photon.filter_distance == SPACE_X_RADIUS + 2: added_anims.append( ApplyMethod( self.second_filter.highlight, RED, @@ -1565,7 +1565,7 @@ class VennDiagramProofByContradiction(Scene): A.generate_target() A.target.scale(4) A.target.shift( - (SPACE_HEIGHT-MED_LARGE_BUFF)*UP - \ + (SPACE_Y_RADIUS-MED_LARGE_BUFF)*UP - \ A.target.get_top() ) A.label.generate_target() @@ -1771,7 +1771,7 @@ class VennDiagramProofByContradiction(Scene): ApplyMethod( m.scale, 0.7, method_kwargs = { - "about_point" : SPACE_HEIGHT*DOWN + "about_point" : SPACE_Y_RADIUS*DOWN } ) for m in everything diff --git a/old_projects/borsuk.py b/old_projects/borsuk.py index 25d6f750..c6399a79 100644 --- a/old_projects/borsuk.py +++ b/old_projects/borsuk.py @@ -52,7 +52,7 @@ class Jewel(VMobject): class Necklace(VMobject): CONFIG = { - "width" : 2*SPACE_WIDTH - 1, + "width" : 2*SPACE_X_RADIUS - 1, "jewel_buff" : MED_SMALL_BUFF, "chain_color" : GREY, "default_colors" : [(4, BLUE), (6, WHITE), (4, GREEN)] @@ -95,7 +95,7 @@ class Necklace(VMobject): class FromPreviousTopologyVideo(Scene): def construct(self): rect = Rectangle(height = 9, width = 16) - rect.scale_to_fit_height(2*SPACE_HEIGHT-2) + rect.scale_to_fit_height(2*SPACE_Y_RADIUS-2) title = TextMobject("From original ``Who cares about topology'' video") title.to_edge(UP) rect.next_to(title, DOWN) @@ -604,7 +604,7 @@ class WriteWords(Scene): def construct(self): words = TextMobject(self.words) words.highlight(self.color) - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) words.to_edge(DOWN) self.play(Write(words)) self.wait(2) @@ -800,7 +800,7 @@ class WalkEquatorPostTransform(GraphScene): equator, dots, rate_func = lambda t : 2*proportion*smooth(t) )) - v_line = DashedLine(SPACE_HEIGHT*UP, SPACE_HEIGHT*DOWN) + v_line = DashedLine(SPACE_Y_RADIUS*UP, SPACE_Y_RADIUS*DOWN) v_line.shift(dots.get_center()[0]*RIGHT) self.play(ShowCreation(v_line)) self.wait() @@ -834,7 +834,7 @@ class WalkEquatorPostTransform(GraphScene): tilted_eq, dots, rate_func = lambda t : 2*proportion*smooth(t) )) - v_line = DashedLine(SPACE_HEIGHT*UP, SPACE_HEIGHT*DOWN) + v_line = DashedLine(SPACE_Y_RADIUS*UP, SPACE_Y_RADIUS*DOWN) v_line.shift(dots.get_center()[0]*RIGHT) self.play(ShowCreation(v_line)) self.wait() @@ -996,7 +996,7 @@ class AntipodalWalkAroundTransverseLoop(ExternallyAnimatedScene): class MentionGenerality(TeacherStudentsScene, ThreeDScene): def construct(self): - necklace = Necklace(width = SPACE_WIDTH) + necklace = Necklace(width = SPACE_X_RADIUS) necklace.shift(2*UP) necklace.to_edge(RIGHT) arrow = TexMobject("\\Leftrightarrow") @@ -1277,7 +1277,7 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): "forced_binary_choices" : (0, 1, 0), "show_matching_after_divvying" : True, "necklace_center" : ORIGIN, - "necklace_width" : 2*SPACE_WIDTH - 3, + "necklace_width" : 2*SPACE_X_RADIUS - 3, "random_seed" : 0, "num_continuous_division_searches" : 4, } @@ -1510,7 +1510,7 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): boxes = VGroup() for group in top_group, bottom_group: box = Rectangle( - width = 2*SPACE_WIDTH-2, + width = 2*SPACE_X_RADIUS-2, height = group.get_height()+SMALL_BUFF, stroke_width = 0, fill_color = WHITE, @@ -1666,7 +1666,7 @@ class ThinkAboutTheChoices(TeacherStudentsScene): """) self.change_student_modes( *["pondering"]*3, - look_at_arg = SPACE_WIDTH*RIGHT+SPACE_HEIGHT*DOWN + look_at_arg = SPACE_X_RADIUS*RIGHT+SPACE_Y_RADIUS*DOWN ) self.wait(3) @@ -1908,7 +1908,7 @@ class CompareThisToSphereChoice(TeacherStudentsScene): """) self.change_student_modes( *["pondering"]*3, - look_at_arg = SPACE_WIDTH*RIGHT+SPACE_HEIGHT*DOWN + look_at_arg = SPACE_X_RADIUS*RIGHT+SPACE_Y_RADIUS*DOWN ) self.wait(3) @@ -1981,7 +1981,7 @@ class ChoicesForSpherePoint(GeneralizeBorsukUlam): buff = LARGE_BUFF, aligned_edge = LEFT ) - choices.scale_to_fit_height(SPACE_HEIGHT) + choices.scale_to_fit_height(SPACE_Y_RADIUS) choices.to_edge(LEFT) choices.shift(DOWN) @@ -2318,7 +2318,7 @@ class ShowFunctionDiagram(TotalLengthOfEachJewelEquals, ReconfigurableScene): def add_necklace(self): random.seed(self.random_seed) ChoicesInNecklaceCutting.add_necklace(self) - self.necklace.scale_to_fit_width(SPACE_WIDTH-1) + self.necklace.scale_to_fit_width(SPACE_X_RADIUS-1) self.necklace.to_edge(UP, buff = LARGE_BUFF) self.necklace.to_edge(LEFT, buff = SMALL_BUFF) self.add(self.necklace) @@ -2337,7 +2337,7 @@ class ShowFunctionDiagram(TotalLengthOfEachJewelEquals, ReconfigurableScene): VGroup(*plane_class.get_top_level_mobjects()) for plane_class in plane_classes ]) - planes.scale_to_fit_width(SPACE_WIDTH) + planes.scale_to_fit_width(SPACE_X_RADIUS) planes.to_edge(RIGHT) self.example_coords = plane_classes[0].example_coords[0] @@ -2433,7 +2433,7 @@ class JewelPairPlane(GraphScene): class WhatThisMappingActuallyLooksLikeWords(Scene): def construct(self): words = TextMobject("What this mapping actually looks like") - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) words.to_edge(DOWN) self.play(Write(words)) diff --git a/old_projects/brachistochrone/curves.py b/old_projects/brachistochrone/curves.py index 7f703727..a20d30f2 100644 --- a/old_projects/brachistochrone/curves.py +++ b/old_projects/brachistochrone/curves.py @@ -376,14 +376,14 @@ class TransitionAwayFromSlide(PathSlidingScene): arrow.copy().shift(vect) for vect in 3*LEFT, ORIGIN, 3*RIGHT ]) - arrows.shift(2*SPACE_WIDTH*RIGHT) + arrows.shift(2*SPACE_X_RADIUS*RIGHT) self.add(arrows) self.add(self.cycloid) self.slide(randy, self.cycloid) everything = Mobject(*self.mobjects) self.play(ApplyMethod( - everything.shift, 4*SPACE_WIDTH*LEFT, + everything.shift, 4*SPACE_X_RADIUS*LEFT, run_time = 2, rate_func = rush_into )) diff --git a/old_projects/brachistochrone/cycloid.py b/old_projects/brachistochrone/cycloid.py index 0a51b320..b9814846 100644 --- a/old_projects/brachistochrone/cycloid.py +++ b/old_projects/brachistochrone/cycloid.py @@ -77,7 +77,7 @@ class CycloidScene(Scene): self.circle.add(radial_line) def generate_ceiling(self): - self.ceiling = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + self.ceiling = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) self.ceiling.shift(self.cycloid.get_top()[1]*UP) def draw_cycloid(self, run_time = 3, *anims, **kwargs): @@ -551,7 +551,7 @@ class SlidingObject(CycloidScene, PathSlidingScene): words1.next_to(arrow, LEFT) words2.next_to(arrow, RIGHT) words = Mobject(words1, arrow, words2) - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) words.to_edge(UP, buff = 0.2) words.to_edge(LEFT) diff --git a/old_projects/brachistochrone/graveyard.py b/old_projects/brachistochrone/graveyard.py index 430670c2..693cd0b0 100644 --- a/old_projects/brachistochrone/graveyard.py +++ b/old_projects/brachistochrone/graveyard.py @@ -74,7 +74,7 @@ class MultilayeredGlass(PhotonScene, ZoomedScene): def get_continuous_background(self): glass = FilledRectangle( height = self.top-self.bottom, - width = 2*SPACE_WIDTH, + width = 2*SPACE_X_RADIUS, ) glass.sort_points(lambda p : -p[1]) glass.shift((self.top-glass.get_top()[1])*UP) @@ -132,7 +132,7 @@ class MultilayeredGlass(PhotonScene, ZoomedScene): angle_of_vector(start_point-end_point)-np.pi/2 ) self.discrete_path.add_line( - points[end], SPACE_WIDTH*RIGHT+(self.layer_tops[-1]-1)*UP + points[end], SPACE_X_RADIUS*RIGHT+(self.layer_tops[-1]-1)*UP ) def show_layer_variables(self): @@ -154,8 +154,8 @@ class MultilayeredGlass(PhotonScene, ZoomedScene): eq_mob.shift(midpoint) v_eq = eq_mob.split() center_paths.append(Line( - midpoint+SPACE_WIDTH*LEFT, - midpoint+SPACE_WIDTH*RIGHT + midpoint+SPACE_X_RADIUS*LEFT, + midpoint+SPACE_X_RADIUS*RIGHT )) brace_endpoints = Mobject( Point(self.top*UP+x*RIGHT), diff --git a/old_projects/brachistochrone/light.py b/old_projects/brachistochrone/light.py index 8b179ddb..9fd4aa71 100644 --- a/old_projects/brachistochrone/light.py +++ b/old_projects/brachistochrone/light.py @@ -133,7 +133,7 @@ class PhotonThroughLens(MultipathPhotonScene): focal_point = 2*RIGHT return [ Mobject( - Line(SPACE_WIDTH*LEFT + fc[1]*UP, fc), + Line(SPACE_X_RADIUS*LEFT + fc[1]*UP, fc), Line(fc, sc), Line(sc, focal_point), Line(focal_point, 6*focal_point-5*sc) @@ -153,7 +153,7 @@ class TransitionToOptics(PhotonThroughLens): if not self.has_started: self.has_started = True everything = Mobject(*self.mobjects) - vect = 2*SPACE_WIDTH*RIGHT + vect = 2*SPACE_X_RADIUS*RIGHT everything.shift(vect) self.play(ApplyMethod( everything.shift, -vect, @@ -164,7 +164,7 @@ class TransitionToOptics(PhotonThroughLens): class PhotonOffMirror(MultipathPhotonScene): def construct(self): - self.mirror = Line(*SPACE_HEIGHT*np.array([DOWN, UP])) + self.mirror = Line(*SPACE_Y_RADIUS*np.array([DOWN, UP])) self.mirror.highlight(GREY) self.add(self.mirror) self.run_along_paths() @@ -201,11 +201,11 @@ class PhotonsInWater(MultipathPhotonScene): start_point = x*RIGHT + y*UP angles = np.arange(np.pi/18, np.pi/3, np.pi/18) midpoints = y*np.arctan(angles) - end_points = midpoints + SPACE_HEIGHT*np.arctan(2*angles) + end_points = midpoints + SPACE_Y_RADIUS*np.arctan(2*angles) return [ Mobject( Line(start_point, [midpoint, 0, 0]), - Line([midpoint, 0, 0], [end_point, -SPACE_HEIGHT, 0]) + Line([midpoint, 0, 0], [end_point, -SPACE_Y_RADIUS, 0]) ).ingest_submobjects() for midpoint, end_point in zip(midpoints, end_points) ] @@ -282,7 +282,7 @@ class ShowMultiplePathsThroughLens(ShowMultiplePathsScene): class ShowMultiplePathsOffMirror(ShowMultiplePathsScene): def construct(self): - mirror = Line(*SPACE_HEIGHT*np.array([DOWN, UP])) + mirror = Line(*SPACE_Y_RADIUS*np.array([DOWN, UP])) mirror.highlight(GREY) self.add(mirror) ShowMultiplePathsScene.construct(self) @@ -399,9 +399,9 @@ class PhtonBendsInWater(PhotonScene, ZoomedScene): kwargs = { "density" : self.zoom_factor*DEFAULT_POINT_DENSITY_1D } - top_line = Line(SPACE_HEIGHT*UP+2*LEFT, ORIGIN, **kwargs) - extension = Line(ORIGIN, SPACE_HEIGHT*DOWN+2*RIGHT, **kwargs) - bottom_line = Line(ORIGIN, SPACE_HEIGHT*DOWN+RIGHT, **kwargs) + top_line = Line(SPACE_Y_RADIUS*UP+2*LEFT, ORIGIN, **kwargs) + extension = Line(ORIGIN, SPACE_Y_RADIUS*DOWN+2*RIGHT, **kwargs) + bottom_line = Line(ORIGIN, SPACE_Y_RADIUS*DOWN+RIGHT, **kwargs) path1 = Mobject(top_line, extension) path2 = Mobject(top_line, bottom_line) for mob in path1, path2: @@ -437,7 +437,7 @@ class LightIsFasterInAirThanWater(ShowMultiplePathsInWater): glass = Region(lambda x, y : y < 0, color = BLUE_E) equation = TexMobject("v_{\\text{air}} > v_{\\text{water}}") equation.to_edge(UP) - path = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + path = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) path1 = path.copy().shift(2*UP) path2 = path.copy().shift(2*DOWN) diff --git a/old_projects/brachistochrone/misc.py b/old_projects/brachistochrone/misc.py index 9e21a609..6368e7ae 100644 --- a/old_projects/brachistochrone/misc.py +++ b/old_projects/brachistochrone/misc.py @@ -88,7 +88,7 @@ class TimeLine(Scene): timeline = NumberLine( numerical_radius = 300, number_at_center = 1800, - unit_length_to_spatial_width = SPACE_WIDTH/100, + unit_length_to_spatial_width = SPACE_X_RADIUS/100, tick_frequency = 10, numbers_with_elongated_ticks = centuries ) diff --git a/old_projects/brachistochrone/multilayered.py b/old_projects/brachistochrone/multilayered.py index 49fcb15c..3b2bc7b2 100644 --- a/old_projects/brachistochrone/multilayered.py +++ b/old_projects/brachistochrone/multilayered.py @@ -38,7 +38,7 @@ class MultilayeredScene(Scene): def get_layers(self, n_layers = None): if n_layers is None: n_layers = self.n_layers - width = 2*SPACE_WIDTH + width = 2*SPACE_X_RADIUS height = float(self.total_glass_height)/n_layers rgb_pair = [ np.array(Color(color).get_rgb()) @@ -75,7 +75,7 @@ class MultilayeredScene(Scene): def get_continuous_glass(self): result = self.RectClass( - width = 2*SPACE_WIDTH, + width = 2*SPACE_X_RADIUS, height = self.total_glass_height, ) result.sort_points(lambda p : -p[1]) @@ -107,10 +107,10 @@ class TwoToMany(MultilayeredScene): def get_glass(self): return self.RectClass( - height = SPACE_HEIGHT, - width = 2*SPACE_WIDTH, + height = SPACE_Y_RADIUS, + width = 2*SPACE_X_RADIUS, color = BLUE_E - ).shift(SPACE_HEIGHT*DOWN/2) + ).shift(SPACE_Y_RADIUS*DOWN/2) class RaceLightInLayers(MultilayeredScene, PhotonScene): @@ -119,7 +119,7 @@ class RaceLightInLayers(MultilayeredScene, PhotonScene): } def construct(self): self.add_layers() - line = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + line = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) lines = [ line.copy().shift(layer.get_center()) for layer in self.layers @@ -180,7 +180,7 @@ class ShowDiscretePath(MultilayeredScene, PhotonScene): angle_of_vector(start_point-end_point)-np.pi/2 ) self.discrete_path.add_line( - points[end], SPACE_WIDTH*RIGHT+(tops[-1]-0.5)*UP + points[end], SPACE_X_RADIUS*RIGHT+(tops[-1]-0.5)*UP ) class NLayers(MultilayeredScene): @@ -229,7 +229,7 @@ class ShowLayerVariables(MultilayeredScene, PhotonScene): eq_mob.shift(layer.get_center()+2*LEFT) v_eq = eq_mob.split() v_eq[0].highlight(layer.get_color()) - path = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + path = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) path.shift(layer.get_center()) brace_endpoints = Mobject( Point(self.top), diff --git a/old_projects/complex_multiplication_article.py b/old_projects/complex_multiplication_article.py index 1b87836e..34289eae 100644 --- a/old_projects/complex_multiplication_article.py +++ b/old_projects/complex_multiplication_article.py @@ -35,12 +35,12 @@ class SuccessiveComplexMultiplications(ComplexMultiplication): def construct(self, *multipliers): norm = abs(reduce(op.mul, multipliers, 1)) - shrink_factor = SPACE_WIDTH/max(SPACE_WIDTH, norm) + shrink_factor = SPACE_X_RADIUS/max(SPACE_X_RADIUS, norm) plane_config = { "density" : norm*DEFAULT_POINT_DENSITY_1D, "unit_to_spatial_width" : shrink_factor, - "x_radius" : shrink_factor*SPACE_WIDTH, - "y_radius" : shrink_factor*SPACE_HEIGHT, + "x_radius" : shrink_factor*SPACE_X_RADIUS, + "y_radius" : shrink_factor*SPACE_Y_RADIUS, } ComplexMultiplication.construct(self, multipliers[0], **plane_config) @@ -115,7 +115,7 @@ class ConjugateDivisionExample(ComplexMultiplication): ] def construct(self, num): - ComplexMultiplication.construct(self, np.conj(num), radius = 2.5*SPACE_WIDTH) + ComplexMultiplication.construct(self, np.conj(num), radius = 2.5*SPACE_X_RADIUS) self.draw_dot("1", 1, True) self.draw_dot("\\bar z", self.multiplier) self.apply_multiplication() @@ -140,7 +140,7 @@ class DrawSolutionsToZToTheNEqualsW(Scene): norm = abs(w) theta = np.log(w).imag radius = norm**(1./n) - zoom_value = (SPACE_HEIGHT-0.5)/radius + zoom_value = (SPACE_Y_RADIUS-0.5)/radius plane_config["unit_to_spatial_width"] = zoom_value plane = ComplexPlane(**plane_config) circle = Circle( @@ -181,7 +181,7 @@ class DrawComplexAngleAndMagnitude(Scene): radius = max([abs(n.imag) for r, n in reps_and_nums]) + 1 plane_config = { "color" : "grey", - "unit_to_spatial_width" : SPACE_HEIGHT / radius, + "unit_to_spatial_width" : SPACE_Y_RADIUS / radius, } plane_config.update(DEFAULT_PLANE_CONFIG) self.plane = ComplexPlane(**plane_config) diff --git a/old_projects/crypto.py b/old_projects/crypto.py index a53a1dfd..629ae0f8 100644 --- a/old_projects/crypto.py +++ b/old_projects/crypto.py @@ -240,7 +240,7 @@ class DisectQuestion(TeacherStudentsScene): "Proof of work, ", "Cryptographic hash functions, \\dots" ) - topics.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + topics.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) topics.to_edge(UP) topics.highlight_by_tex("Digital", BLUE) topics.highlight_by_tex("Proof", GREEN) @@ -282,7 +282,7 @@ class CryptocurrencyEquation(Scene): "= Cryptocurrency" ) VGroup(*parts[-1][1:]).highlight(YELLOW) - parts.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + parts.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) for part in parts: self.play(FadeIn(part)) @@ -398,7 +398,7 @@ class NoCommentOnSpeculation(TeacherStudentsScene): self.play(ShowCreation(cross)) group.add(cross) self.play( - group.shift, 2*SPACE_WIDTH*RIGHT, + group.shift, 2*SPACE_X_RADIUS*RIGHT, self.teacher.change, "happy" ) self.wait() @@ -418,7 +418,7 @@ class NoCommentOnSpeculation(TeacherStudentsScene): self.wait() self.play( VGroup(mining_graphic, mining_cross).shift, - 2*SPACE_WIDTH*RIGHT + 2*SPACE_X_RADIUS*RIGHT ) black_words = TextMobject("Random words\\\\Blah blah") black_words.highlight(BLACK) @@ -1586,7 +1586,7 @@ class CharlieRacksUpDebt(SignedLedgerScene): if pi is not self.charlie ]) self.play( - self.charlie.shift, SPACE_WIDTH*RIGHT, + self.charlie.shift, SPACE_X_RADIUS*RIGHT, rate_func = running_start ) self.play(*[ @@ -2063,7 +2063,7 @@ class BigDifferenceBetweenLDAndCryptocurrencies(Scene): words.scale(1.5) words.to_edge(UP) for word, vect in zip(words, [RIGHT, LEFT]): - word.shift(SPACE_WIDTH*vect/2) + word.shift(SPACE_X_RADIUS*vect/2) self.add(logos) self.wait() @@ -2077,7 +2077,7 @@ class BigDifferenceBetweenLDAndCryptocurrencies(Scene): class DistributedLedgerScene(LedgerScene): def get_large_network(self): network = self.get_network() - network.scale_to_fit_height(2*SPACE_HEIGHT - LARGE_BUFF) + network.scale_to_fit_height(2*SPACE_Y_RADIUS - LARGE_BUFF) network.center() for pi in self.pi_creatures: pi.label.scale(0.8, about_point = pi.get_bottom()) @@ -2187,7 +2187,7 @@ class TransitionToDistributedLedger(DistributedLedgerScene): for pi in self.pi_creatures ]) self.play( - group.scale_to_fit_height, 2*SPACE_HEIGHT - 2, + group.scale_to_fit_height, 2*SPACE_Y_RADIUS - 2, group.center ) self.wait(2) @@ -2288,7 +2288,7 @@ class BobDoubtsBroadcastTransaction(DistributedLedgerScene): def bob_receives_transaction(self): bob, charlie = self.bob, self.charlie - corner = SPACE_HEIGHT*UP + SPACE_WIDTH*LEFT + corner = SPACE_Y_RADIUS*UP + SPACE_X_RADIUS*LEFT payment = TextMobject( "Alice", "pays", "Bob", "10 LD" @@ -2344,7 +2344,7 @@ class YouListeningToBroadcasts(LedgerScene): ]) self.remove(self.ledger) corners = [ - SPACE_WIDTH*RIGHT*u1 + SPACE_HEIGHT*UP*u2 + SPACE_X_RADIUS*RIGHT*u1 + SPACE_Y_RADIUS*UP*u2 for u1, u2 in (-1, 1), (1, 1), (-1, -1) ] you = self.you @@ -3361,7 +3361,7 @@ class FromBankToDecentralizedSystem(DistributedBlockChainScene): self.play(ShowCreation(cross)) self.wait() self.play( - group.next_to, SPACE_WIDTH*RIGHT, RIGHT, + group.next_to, SPACE_X_RADIUS*RIGHT, RIGHT, rate_func = running_start, path_arc = -np.pi/6, ) @@ -3868,7 +3868,7 @@ class TwoBlockChains(DistributedBlockChainScene): randy.change("raise_right_hand", chain) corners = [ - u1*SPACE_WIDTH*RIGHT + u2*SPACE_HEIGHT*UP + u1*SPACE_X_RADIUS*RIGHT + u2*SPACE_Y_RADIUS*UP for u1, u2 in it.product(*[[-1, 1]]*2) ] moving_blocks = chain.blocks[1:] @@ -3925,7 +3925,7 @@ class TwoBlockChains(DistributedBlockChainScene): chain = block_chains[1] chain.save_state() - corner = SPACE_WIDTH*LEFT + SPACE_HEIGHT*UP + corner = SPACE_X_RADIUS*LEFT + SPACE_Y_RADIUS*UP chain.next_to(corner, UP+LEFT) self.play( randy.change, "confused", chain, @@ -3982,7 +3982,7 @@ class TwoBlockChains(DistributedBlockChainScene): self.wait() arrow_block = arrow_block.copy() - arrow_block.next_to(SPACE_WIDTH*RIGHT, RIGHT) + arrow_block.next_to(SPACE_X_RADIUS*RIGHT, RIGHT) self.play( ApplyMethod( arrow_block.next_to, block_chains[0], RIGHT, 0, @@ -4479,7 +4479,7 @@ class WhenToTrustANewBlock(DistributedBlockChainScene): block = blocks[-1].copy() arrow = arrows[-1].copy() VGroup(block, arrow).next_to(blocks[-1], RIGHT, buff = 0) - corner = SPACE_WIDTH*RIGHT + SPACE_HEIGHT*UP + corner = SPACE_X_RADIUS*RIGHT + SPACE_Y_RADIUS*UP block.save_state() block.next_to(corner, UP+RIGHT) @@ -4505,7 +4505,7 @@ class MainIdeas(Scene): title = TextMobject("Main ideas") title.scale(1.5) h_line = Line(LEFT, RIGHT) - h_line.scale_to_fit_width(SPACE_WIDTH) + h_line.scale_to_fit_width(SPACE_X_RADIUS) h_line.next_to(title, DOWN) VGroup(title, h_line).to_corner(UP+LEFT) @@ -4625,7 +4625,7 @@ class VariableProofOfWork(WhenToTrustANewBlock): ]) everyone = VGroup(target, *copies) everyone.arrange_submobjects(DOWN) - everyone.scale_to_fit_height(2*SPACE_HEIGHT - LARGE_BUFF) + everyone.scale_to_fit_height(2*SPACE_Y_RADIUS - LARGE_BUFF) everyone.to_corner(UP+LEFT) self.play(Transform(miner_block, target)) @@ -4668,7 +4668,7 @@ class CompareBlockTimes(Scene): title.scale(1.5) title.to_edge(UP) h_line = Line(LEFT, RIGHT) - h_line.scale_to_fit_width(SPACE_WIDTH) + h_line.scale_to_fit_width(SPACE_X_RADIUS) h_line.next_to(title, DOWN, SMALL_BUFF) examples = VGroup( @@ -4730,7 +4730,7 @@ class BlockRewards(Scene): title.add(logo) title.to_edge(UP) h_line = Line(LEFT, RIGHT) - h_line.scale_to_fit_width(SPACE_WIDTH) + h_line.scale_to_fit_width(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title, logo, h_line) @@ -4847,7 +4847,7 @@ class TransactionFeeExample(PiCreatureScene): def create_pi_creature(self): alice = PiCreature(color = BLUE_C) alice.to_edge(DOWN) - alice.shift(SPACE_WIDTH*LEFT/2) + alice.shift(SPACE_X_RADIUS*LEFT/2) return alice class ShowBitcoinBlockSize(LedgerScene): @@ -5269,7 +5269,7 @@ class Thumbnail(DistributedBlockChainScene): block_chain = self.get_block_chain() block_chain.arrows.highlight(RED) block_chain.blocks.gradient_highlight(BLUE, GREEN) - block_chain.scale_to_fit_width(2*SPACE_WIDTH-1) + block_chain.scale_to_fit_width(2*SPACE_X_RADIUS-1) block_chain.set_stroke(width = 12) self.add(block_chain) diff --git a/old_projects/domino_play.py b/old_projects/domino_play.py index 3090f907..e0efa165 100644 --- a/old_projects/domino_play.py +++ b/old_projects/domino_play.py @@ -664,7 +664,7 @@ class ContrastTwoGraphs(SimpleVelocityGraph): dot1, dot2 = dots[21], dots[41] rect = Rectangle( width = dot2.get_center()[0] - dot1.get_center()[0], - height = SPACE_HEIGHT - self.x_axis.get_center()[1], + height = SPACE_Y_RADIUS - self.x_axis.get_center()[1], stroke_width = 0, fill_color = YELLOW, fill_opacity = 0.5 diff --git a/old_projects/efvgt.py b/old_projects/efvgt.py index bc57cd9f..266c4b52 100644 --- a/old_projects/efvgt.py +++ b/old_projects/efvgt.py @@ -74,9 +74,9 @@ class ConfettiSpiril(Animation): } def __init__(self, mobject, **kwargs): digest_config(self, kwargs) - mobject.next_to(self.x_start*RIGHT + SPACE_HEIGHT*UP, UP) + mobject.next_to(self.x_start*RIGHT + SPACE_Y_RADIUS*UP, UP) self.total_vert_shift = \ - 2*SPACE_HEIGHT + mobject.get_height() + 2*MED_SMALL_BUFF + 2*SPACE_Y_RADIUS + mobject.get_height() + 2*MED_SMALL_BUFF Animation.__init__(self, mobject, **kwargs) @@ -107,7 +107,7 @@ def get_confetti_animations(num_confetti_squares): confetti_spirils = [ ConfettiSpiril( square, - x_start = 2*random.random()*SPACE_WIDTH - SPACE_WIDTH, + x_start = 2*random.random()*SPACE_X_RADIUS - SPACE_X_RADIUS, rate_func = squish_rate_func(lambda t : t, a, a+0.5) ) for a, square in zip( @@ -462,7 +462,7 @@ class SymmetriesOfSquare(ThreeDScene): bottom_squares = VGroup(*all_squares[4:]) bottom_squares.next_to(top_squares, DOWN, buff = LARGE_BUFF) - all_squares.scale_to_fit_width(2*SPACE_WIDTH-2*LARGE_BUFF) + all_squares.scale_to_fit_width(2*SPACE_X_RADIUS-2*LARGE_BUFF) all_squares.center() all_squares.to_edge(DOWN, buff = LARGE_BUFF) @@ -1127,7 +1127,7 @@ class DihedralGroupStructure(SymmetriesOfSquare): "axis" : axis, } expression.arrange_submobjects() - expression.scale_to_fit_width(SPACE_WIDTH+1) + expression.scale_to_fit_width(SPACE_X_RADIUS+1) expression.to_edge(RIGHT, buff = SMALL_BUFF) for square in s1, s2, s3: square.remove(square.action_illustration) @@ -1166,9 +1166,9 @@ class DihedralGroupStructure(SymmetriesOfSquare): target.scale(self.filed_sum_scale_factor) y_index = self.num_sum_expressions%self.num_rows y_prop = float(y_index)/(self.num_rows-1) - y = interpolate(SPACE_HEIGHT-LARGE_BUFF, -SPACE_HEIGHT+LARGE_BUFF, y_prop) + y = interpolate(SPACE_Y_RADIUS-LARGE_BUFF, -SPACE_Y_RADIUS+LARGE_BUFF, y_prop) x_index = self.num_sum_expressions//self.num_rows - x_spacing = 2*SPACE_WIDTH/3 + x_spacing = 2*SPACE_X_RADIUS/3 x = (x_index-1)*x_spacing target.move_to(x*RIGHT + y*UP) @@ -1193,7 +1193,7 @@ class ThisIsAVeryGeneralIdea(Scene): ])) numbers = examples[-1] examples.arrange_submobjects(buff = LARGE_BUFF) - examples.scale_to_fit_width(2*SPACE_WIDTH-1) + examples.scale_to_fit_width(2*SPACE_X_RADIUS-1) examples.move_to(UP) lines = VGroup(*[ @@ -1257,8 +1257,8 @@ class AdditiveGroupOfReals(Scene): "number_line_center" : UP, "shadow_line_center" : DOWN, "zero_color" : GREEN_B, - "x_min" : -2*SPACE_WIDTH, - "x_max" : 2*SPACE_WIDTH, + "x_min" : -2*SPACE_X_RADIUS, + "x_max" : 2*SPACE_X_RADIUS, } def construct(self): self.add_number_line() @@ -1456,10 +1456,10 @@ class AdditiveGroupOfReals(Scene): class AdditiveGroupOfComplexNumbers(ComplexTransformationScene): CONFIG = { - "x_min" : -2*int(SPACE_WIDTH), - "x_max" : 2*int(SPACE_WIDTH), - "y_min" : -2*SPACE_HEIGHT, - "y_max" : 2*SPACE_HEIGHT, + "x_min" : -2*int(SPACE_X_RADIUS), + "x_max" : 2*int(SPACE_X_RADIUS), + "y_min" : -2*SPACE_Y_RADIUS, + "y_max" : 2*SPACE_Y_RADIUS, "example_points" : [ complex(3, 2), complex(1, -3), @@ -1730,13 +1730,13 @@ class AdditiveGroupOfComplexNumbers(ComplexTransformationScene): class SchizophrenicNumbers(Scene): def construct(self): v_line = DashedLine( - SPACE_HEIGHT*UP, - SPACE_HEIGHT*DOWN + SPACE_Y_RADIUS*UP, + SPACE_Y_RADIUS*DOWN ) left_title = TextMobject("Additive group") - left_title.shift(SPACE_WIDTH*LEFT/2) + left_title.shift(SPACE_X_RADIUS*LEFT/2) right_title = TextMobject("Multiplicative group") - right_title.shift(SPACE_WIDTH*RIGHT/2) + right_title.shift(SPACE_X_RADIUS*RIGHT/2) VGroup(left_title, right_title).to_edge(UP) self.add(v_line, left_title, right_title) @@ -1755,7 +1755,7 @@ class SchizophrenicNumbers(Scene): number.eyes = Eyes(number[0], height = 0.1) number.add(number.eyes) numbers[3].eyes.next_to(numbers[3][1], UP, buff = 0) - numbers.shift(SPACE_WIDTH*LEFT/2) + numbers.shift(SPACE_X_RADIUS*LEFT/2) self.play(FadeIn(numbers)) self.blink_numbers(numbers) @@ -1763,7 +1763,7 @@ class SchizophrenicNumbers(Scene): self.add(numbers.copy()) for number in numbers: number.generate_target() - number.target.shift(SPACE_WIDTH*RIGHT) + number.target.shift(SPACE_X_RADIUS*RIGHT) number.target.eyes.save_state() number.target.highlight(MULTIPLIER_COLOR) number.target.eyes.restore() @@ -1797,8 +1797,8 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): CONFIG = { "number_line_center" : 0.5*UP, "shadow_line_center" : 1.5*DOWN, - "x_min" : -3*SPACE_WIDTH, - "x_max" : 3*SPACE_WIDTH, + "x_min" : -3*SPACE_X_RADIUS, + "x_max" : 3*SPACE_X_RADIUS, "positive_reals_color" : MAROON_B, } def setup(self): @@ -1944,7 +1944,7 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): def every_positive_number_association(self): positive_reals_line = Line( self.shadow_line.number_to_point(0), - self.shadow_line.number_to_point(SPACE_WIDTH), + self.shadow_line.number_to_point(SPACE_X_RADIUS), color = self.positive_reals_color ) positive_reals_words = TextMobject("All positive reals") @@ -2061,8 +2061,8 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): class MultiplicativeGroupOfComplexNumbers(AdditiveGroupOfComplexNumbers): CONFIG = { "dot_radius" : Dot.CONFIG["radius"], - "y_min" : -3*SPACE_HEIGHT, - "y_max" : 3*SPACE_HEIGHT, + "y_min" : -3*SPACE_Y_RADIUS, + "y_max" : 3*SPACE_Y_RADIUS, } def construct(self): self.add_plane() @@ -2297,7 +2297,7 @@ class MultiplicativeGroupOfComplexNumbers(AdditiveGroupOfComplexNumbers): self.wait() def show_break_down(self): - positive_reals = Line(ORIGIN, SPACE_WIDTH*RIGHT) + positive_reals = Line(ORIGIN, SPACE_X_RADIUS*RIGHT) positive_reals.highlight(MAROON_B) circle = Circle( radius = self.z_to_point(1)[0], @@ -2559,8 +2559,8 @@ class ExponentsAsHomomorphism(Scene): }, "bottom_line_center" : 2.5*DOWN, "bottom_line_config" : { - "x_min" : -2*SPACE_WIDTH, - "x_max" : 2*SPACE_WIDTH, + "x_min" : -2*SPACE_X_RADIUS, + "x_max" : 2*SPACE_X_RADIUS, } } def construct(self): @@ -2869,9 +2869,9 @@ class ComplexExponentiationAbstract(): self.wait() def add_vertical_line(self): - line = Line(SPACE_HEIGHT*UP, SPACE_HEIGHT*DOWN) + line = Line(SPACE_Y_RADIUS*UP, SPACE_Y_RADIUS*DOWN) line.set_stroke(color = self.color, width = 10) - line.shift(-SPACE_WIDTH*self.vect/2) + line.shift(-SPACE_X_RADIUS*self.vect/2) self.add(line) self.add_foreground_mobjects(line) @@ -2891,7 +2891,7 @@ class ComplexExponentiationAbstract(): def add_arrow(self): arrow = Arrow(LEFT, RIGHT, color = WHITE) - arrow.move_to(-SPACE_WIDTH*self.vect/2 + 2*UP) + arrow.move_to(-SPACE_X_RADIUS*self.vect/2 + 2*UP) arrow.set_stroke(width = 6), func_mob = TexMobject("2^x") func_mob.next_to(arrow, UP, aligned_edge = LEFT) @@ -2909,9 +2909,9 @@ class ComplexExponentiationAbstract(): ) def draw_real_line(self): - line = VGroup(Line(ORIGIN, SPACE_WIDTH*RIGHT)) + line = VGroup(Line(ORIGIN, SPACE_X_RADIUS*RIGHT)) if self.vect[0] < 0: - line.add(Line(ORIGIN, SPACE_WIDTH*LEFT)) + line.add(Line(ORIGIN, SPACE_X_RADIUS*LEFT)) line.highlight(RED) self.play(*map(ShowCreation, line), run_time = 3) @@ -2945,7 +2945,7 @@ class ComplexExponentiationAbstract(): formula[-1].highlight(MULTIPLIER_COLOR) formula.scale(1.5) formula.next_to(ORIGIN, UP) - formula.shift(-SPACE_WIDTH*self.vect/2) + formula.shift(-SPACE_X_RADIUS*self.vect/2) for part in formula: part.add_to_back(BackgroundRectangle(part)) @@ -2977,8 +2977,8 @@ class ComplexExponentiationAdderHalf( def highlight_vertical_line(self): line = VGroup( - Line(ORIGIN, SPACE_HEIGHT*UP), - Line(ORIGIN, SPACE_HEIGHT*DOWN), + Line(ORIGIN, SPACE_Y_RADIUS*UP), + Line(ORIGIN, SPACE_Y_RADIUS*DOWN), ) line.highlight(YELLOW) @@ -2998,8 +2998,8 @@ class ComplexExponentiationAdderHalf( def highlight_unit_circle(self): line = VGroup( - Line(ORIGIN, SPACE_HEIGHT*UP), - Line(ORIGIN, SPACE_HEIGHT*DOWN), + Line(ORIGIN, SPACE_Y_RADIUS*UP), + Line(ORIGIN, SPACE_Y_RADIUS*DOWN), ) line.highlight(YELLOW) for submob in line: @@ -3010,7 +3010,7 @@ class ComplexExponentiationAdderHalf( Circle().flip(RIGHT), ) circle.highlight(YELLOW) - circle.shift(SPACE_WIDTH*RIGHT) + circle.shift(SPACE_X_RADIUS*RIGHT) self.play(ReplacementTransform( line, circle, run_time = 3 @@ -3102,11 +3102,11 @@ class ComplexExponentiationMultiplierHalf( def highlight_unit_circle(self): line = VGroup( - Line(ORIGIN, SPACE_HEIGHT*UP), - Line(ORIGIN, SPACE_HEIGHT*DOWN), + Line(ORIGIN, SPACE_Y_RADIUS*UP), + Line(ORIGIN, SPACE_Y_RADIUS*DOWN), ) line.highlight(YELLOW) - line.shift(SPACE_WIDTH*LEFT) + line.shift(SPACE_X_RADIUS*LEFT) for submob in line: submob.insert_n_anchor_points(10) submob.make_smooth() diff --git a/old_projects/eoc/chapter1.py b/old_projects/eoc/chapter1.py index 13dfe4a4..655cac93 100644 --- a/old_projects/eoc/chapter1.py +++ b/old_projects/eoc/chapter1.py @@ -250,7 +250,7 @@ class Introduction(TeacherStudentsScene): this_video.save_state() this_video.set_fill(opacity = 0) this_video.center() - this_video.scale_to_fit_height(2*SPACE_HEIGHT) + this_video.scale_to_fit_height(2*SPACE_Y_RADIUS) self.this_video = this_video @@ -386,8 +386,8 @@ class Introduction(TeacherStudentsScene): arrow = Arrow(invent_calculus, student) fader = Rectangle( - width = 2*SPACE_WIDTH, - height = 2*SPACE_HEIGHT, + width = 2*SPACE_X_RADIUS, + height = 2*SPACE_Y_RADIUS, stroke_width = 0, fill_color = BLACK, fill_opacity = 0.5, @@ -410,7 +410,7 @@ class Introduction(TeacherStudentsScene): class PreviewFrame(Scene): def construct(self): frame = Rectangle(height = 9, width = 16, color = WHITE) - frame.scale_to_fit_height(1.5*SPACE_HEIGHT) + frame.scale_to_fit_height(1.5*SPACE_Y_RADIUS) colors = iter(color_gradient([BLUE, YELLOW], 3)) titles = [ @@ -1439,7 +1439,7 @@ class GraphRectangles(CircleScene, GraphScene): arranged_group.add(last_ring.target) arranged_group.arrange_submobjects(DOWN, buff = SMALL_BUFF) - arranged_group.scale_to_fit_height(2*SPACE_HEIGHT-1) + arranged_group.scale_to_fit_height(2*SPACE_Y_RADIUS-1) arranged_group.to_corner(DOWN+LEFT, buff = MED_SMALL_BUFF) for mob in tex_mobs: mob.scale_in_place(0.7) @@ -2064,7 +2064,7 @@ class AreaUnderParabola(GraphScene): v_lines = VGroup(*[ DashedLine( - 2*SPACE_HEIGHT*UP, ORIGIN, + 2*SPACE_Y_RADIUS*UP, ORIGIN, color = RED ).move_to(self.coords_to_point(x, 0), DOWN) for x in 0, self.default_right_x @@ -2616,7 +2616,7 @@ class AlternateAreaUnderCurve(PlayingTowardsDADX): class NextVideoWrapper(Scene): def construct(self): rect = Rectangle(height = 9, width = 16) - rect.scale_to_fit_height(1.5*SPACE_HEIGHT) + rect.scale_to_fit_height(1.5*SPACE_Y_RADIUS) titles = [ TextMobject("Chapter %d:"%d, s) for d, s in [ diff --git a/old_projects/eoc/chapter10.py b/old_projects/eoc/chapter10.py index d412d11a..ba6c2dee 100644 --- a/old_projects/eoc/chapter10.py +++ b/old_projects/eoc/chapter10.py @@ -399,7 +399,7 @@ class Pendulum(ReconfigurableScene): def get_ceiling(self): line = Line(LEFT, RIGHT, color = GREY) - line.scale(SPACE_WIDTH) + line.scale(SPACE_X_RADIUS) line.move_to(self.anchor_point[1]*UP) return line @@ -1365,8 +1365,8 @@ class CubicAndQuarticApproximations(ConstructQuadraticApproximation): ) self.quadratic_graph = self.get_quadratic_graph() self.big_rect = Rectangle( - height = 2*SPACE_HEIGHT, - width = 2*SPACE_WIDTH, + height = 2*SPACE_Y_RADIUS, + width = 2*SPACE_X_RADIUS, stroke_width = 0, fill_color = BLACK, fill_opacity = 0.5, @@ -1898,7 +1898,7 @@ class EachTermControlsOneDerivative(Scene): buff = LARGE_BUFF, aligned_edge = UP ) - deriv_words.scale_to_fit_width(2*SPACE_WIDTH - MED_LARGE_BUFF) + deriv_words.scale_to_fit_width(2*SPACE_X_RADIUS - MED_LARGE_BUFF) deriv_words.to_edge(UP) for const, deriv, color in zip(consts, deriv_words, colors): @@ -2150,7 +2150,7 @@ class TranslationOfInformation(CubicAndQuarticApproximations): ))) group.add(TexMobject("\\vdots")) group.arrange_submobjects(DOWN, buff = SMALL_BUFF) - group.scale_to_fit_height(2*SPACE_HEIGHT - MED_LARGE_BUFF) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - MED_LARGE_BUFF) group.to_edge(LEFT) for dx, d0, color in zip(derivs_at_x, derivs_at_zero, self.colors): for d in dx, d0: @@ -2303,7 +2303,7 @@ class TranslationOfInformation(CubicAndQuarticApproximations): for arg in "x", "0", "a" ] derivs_at_x.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) - derivs_at_x.scale_to_fit_height(2*SPACE_HEIGHT - MED_LARGE_BUFF) + derivs_at_x.scale_to_fit_height(2*SPACE_Y_RADIUS - MED_LARGE_BUFF) derivs_at_x.to_edge(LEFT) zeros = VGroup(*[ deriv.get_part_by_tex("0") @@ -2503,7 +2503,7 @@ class ThisIsAStandardFormula(TeacherStudentsScene): ) self.change_student_modes( *["sad"]*3, - look_at_arg = SPACE_HEIGHT*UP + look_at_arg = SPACE_Y_RADIUS*UP ) self.wait(2) @@ -2563,7 +2563,7 @@ class ExpPolynomial(TranslationOfInformation, ExampleApproximationWithExp): ))) group.add(TexMobject("\\vdots")) group.arrange_submobjects(DOWN, buff = 2*SMALL_BUFF) - group.scale_to_fit_height(2*SPACE_HEIGHT - MED_LARGE_BUFF) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - MED_LARGE_BUFF) group.to_edge(LEFT) for dx, d0 in zip(derivs_at_x, derivs_at_zero): for d in dx, d0: @@ -3021,8 +3021,8 @@ class AskAboutInfiniteSum(TeacherStudentsScene): def ask_question(self): big_rect = Rectangle( - width = 2*SPACE_WIDTH, - height = 2*SPACE_HEIGHT, + width = 2*SPACE_X_RADIUS, + height = 2*SPACE_Y_RADIUS, stroke_width = 0, fill_color = BLACK, fill_opacity = 0.7, @@ -3597,7 +3597,7 @@ class MoreToBeSaid(TeacherStudentsScene): words.to_edge(UP) fade_rect = FullScreenFadeRectangle() rect = Rectangle(height = 9, width = 16) - rect.scale_to_fit_height(SPACE_HEIGHT) + rect.scale_to_fit_height(SPACE_Y_RADIUS) rect.to_corner(UP+RIGHT) randy = self.get_students()[1] @@ -3686,7 +3686,7 @@ class Thumbnail(ExampleApproximationWithSine): self.add(cos_graph, quad_graph, quartic) title = TextMobject("Taylor Series") - title.scale_to_fit_width(1.5*SPACE_WIDTH) + title.scale_to_fit_width(1.5*SPACE_X_RADIUS) title.add_background_rectangle() title.to_edge(UP) self.add(title) diff --git a/old_projects/eoc/chapter2.py b/old_projects/eoc/chapter2.py index 29236d7f..4d99ff46 100644 --- a/old_projects/eoc/chapter2.py +++ b/old_projects/eoc/chapter2.py @@ -143,7 +143,7 @@ class Introduction(TeacherStudentsScene): *it.chain(*[ [ pi.change_mode, mode, - pi.look_at, SPACE_HEIGHT*UP + pi.look_at, SPACE_Y_RADIUS*UP ] for pi, mode in zip(self.get_pi_creatures(), [ "speaking", "pondering", "confused", "confused", @@ -666,8 +666,8 @@ class SnapshotOfACar(Scene): car.scale(1.5) car.move_to(3*LEFT+DOWN) flash_box = Rectangle( - width = 2*SPACE_WIDTH, - height = 2*SPACE_HEIGHT, + width = 2*SPACE_X_RADIUS, + height = 2*SPACE_Y_RADIUS, stroke_width = 0, fill_color = WHITE, fill_opacity = 1, @@ -723,8 +723,8 @@ class CompareTwoTimes(Scene): state2.to_corner(DOWN+LEFT) dividers = VGroup( - Line(SPACE_WIDTH*LEFT, RIGHT), - Line(RIGHT+SPACE_HEIGHT*UP, RIGHT+SPACE_HEIGHT*DOWN), + Line(SPACE_X_RADIUS*LEFT, RIGHT), + Line(RIGHT+SPACE_Y_RADIUS*UP, RIGHT+SPACE_Y_RADIUS*DOWN), ) dividers.highlight(GREY) @@ -1992,7 +1992,7 @@ class YouWouldntDoThisEveryTime(TeacherStudentsScene): self.wait(3) series = VideoSeries() - series.scale_to_fit_width(2*SPACE_WIDTH-1) + series.scale_to_fit_width(2*SPACE_X_RADIUS-1) series.to_edge(UP) this_video = series[1] next_video = series[2] @@ -2008,7 +2008,7 @@ class YouWouldntDoThisEveryTime(TeacherStudentsScene): class ContrastConcreteDtWithLimit(Scene): def construct(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) self.add(v_line) l_title = TextMobject(""" @@ -2020,7 +2020,7 @@ class ContrastConcreteDtWithLimit(Scene): VGroup(*r_title[:2]).highlight(TIME_COLOR) for title, vect in (l_title, LEFT), (r_title, RIGHT): title.to_edge(UP) - title.shift(SPACE_WIDTH*vect/2) + title.shift(SPACE_X_RADIUS*vect/2) self.add(title) l_formula = TexMobject(""" @@ -2040,7 +2040,7 @@ class ContrastConcreteDtWithLimit(Scene): l_formula[27:29], l_formula[35:37], )).highlight(TIME_COLOR) - l_formula.scale_to_fit_width(SPACE_WIDTH-MED_LARGE_BUFF) + l_formula.scale_to_fit_width(SPACE_X_RADIUS-MED_LARGE_BUFF) l_formula.to_edge(LEFT) l_brace = Brace(l_formula, DOWN) @@ -2051,7 +2051,7 @@ class ContrastConcreteDtWithLimit(Scene): "\\frac{d(t^3)}{dt} = 3t^2" ) VGroup(*r_formula[6:8]).highlight(TIME_COLOR) - r_formula.shift(SPACE_WIDTH*RIGHT/2) + r_formula.shift(SPACE_X_RADIUS*RIGHT/2) r_brace = Brace(r_formula, DOWN) r_text = r_brace.get_text("Simple") r_text.highlight(GREEN) @@ -2427,7 +2427,7 @@ class TinyMovement(ZoomedScene): class NextVideos(TeacherStudentsScene): def construct(self): series = VideoSeries() - series.scale_to_fit_width(2*SPACE_WIDTH - 1) + series.scale_to_fit_width(2*SPACE_X_RADIUS - 1) series.to_edge(UP) series[1].highlight(YELLOW) self.add(series) @@ -2592,7 +2592,7 @@ class Thumbnail(SecantLineToTangentLine): VGroup(*self.get_mobjects()).fade(0.4) title = TextMobject("Derivative paradox") - title.scale_to_fit_width(2*SPACE_WIDTH-1) + title.scale_to_fit_width(2*SPACE_X_RADIUS-1) title.to_edge(UP) title.add_background_rectangle() title.gradient_highlight(GREEN, YELLOW) diff --git a/old_projects/eoc/chapter3.py b/old_projects/eoc/chapter3.py index 117359a0..6b3b2742 100644 --- a/old_projects/eoc/chapter3.py +++ b/old_projects/eoc/chapter3.py @@ -69,14 +69,14 @@ class PoseAbstractDerivative(TeacherStudentsScene): class ContrastAbstractAndConcrete(Scene): def construct(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) l_title = TextMobject("Abstract functions") - l_title.shift(SPACE_WIDTH*LEFT/2) + l_title.shift(SPACE_X_RADIUS*LEFT/2) l_title.to_edge(UP) r_title = TextMobject("Applications") - r_title.shift(SPACE_WIDTH*RIGHT/2) + r_title.shift(SPACE_X_RADIUS*RIGHT/2) r_title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.shift((r_title.get_bottom()[1]-MED_SMALL_BUFF)*UP) functions = VGroup(*map(TexMobject, [ @@ -90,7 +90,7 @@ class ContrastAbstractAndConcrete(Scene): aligned_edge = LEFT, buff = LARGE_BUFF ) - functions.shift(SPACE_WIDTH*LEFT/2) + functions.shift(SPACE_X_RADIUS*LEFT/2) functions[-1].shift(MED_LARGE_BUFF*RIGHT) self.add(l_title, r_title) @@ -171,7 +171,7 @@ class ContrastAbstractAndConcrete(Scene): pis.scale_to_fit_height(3) pis.center() pis.to_edge(DOWN, buff = SMALL_BUFF) - pis.shift(SPACE_WIDTH*RIGHT/2.) + pis.shift(SPACE_X_RADIUS*RIGHT/2.) anims = [] for index, pi in enumerate(pis): @@ -224,7 +224,7 @@ class ListOfRules(PiCreatureScene): aligned_edge = LEFT, ) rules[-1].shift(MED_LARGE_BUFF*RIGHT) - rules.scale_to_fit_height(2*SPACE_HEIGHT-1) + rules.scale_to_fit_height(2*SPACE_Y_RADIUS-1) rules.next_to(self.pi_creature, RIGHT) rules.to_edge(DOWN) @@ -381,7 +381,7 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene): self.disactivate_zooming() self.play( ApplyMethod( - everything.shift, 2*SPACE_WIDTH*LEFT, + everything.shift, 2*SPACE_X_RADIUS*LEFT, rate_func = lambda t : running_start(t, -0.1) ), self.pi_creature.change_mode, "happy" @@ -857,7 +857,7 @@ class NudgeSideLengthOfCube(Scene): def add_title(self): title = TexMobject("f(x) = x^3") - title.shift(SPACE_WIDTH*LEFT/2) + title.shift(SPACE_X_RADIUS*LEFT/2) title.to_edge(UP) self.play(Write(title)) self.wait() @@ -957,7 +957,7 @@ class NudgeSideLengthOfCube(Scene): self.shrink_dx("Faces are introduced") face = self.faces[0] face.save_state() - self.play(face.shift, SPACE_WIDTH*RIGHT) + self.play(face.shift, SPACE_X_RADIUS*RIGHT) x_squared_dx.next_to(face, LEFT) self.play(Write(x_squared_dx, run_time = 1)) self.wait() @@ -1229,11 +1229,11 @@ class GraphOfXCubed(GraphScene): CONFIG = { "x_min" : -6, "x_max" : 6, - "x_axis_width" : 2*SPACE_WIDTH, + "x_axis_width" : 2*SPACE_X_RADIUS, "x_labeled_nums" : range(-6, 7), "y_min" : -35, "y_max" : 35, - "y_axis_height" : 2*SPACE_HEIGHT, + "y_axis_height" : 2*SPACE_Y_RADIUS, "y_tick_frequency" : 5, "y_labeled_nums" : range(-30, 40, 10), "graph_origin" : ORIGIN, @@ -1331,7 +1331,7 @@ class PatternForPowerRule(PiCreatureScene): DOWN, aligned_edge = LEFT, buff = MED_LARGE_BUFF ) - derivatives.scale_to_fit_height(2*SPACE_HEIGHT-1) + derivatives.scale_to_fit_height(2*SPACE_Y_RADIUS-1) derivatives.to_edge(LEFT) self.play(FadeIn(derivatives[0])) @@ -1629,7 +1629,7 @@ class ReactToFullExpansion(Scene): class OneOverX(PiCreatureScene, GraphScene): CONFIG = { "unit_length" : 3.0, - "graph_origin" : (SPACE_WIDTH - LARGE_BUFF)*LEFT + 2*DOWN, + "graph_origin" : (SPACE_X_RADIUS - LARGE_BUFF)*LEFT + 2*DOWN, "rectangle_color_kwargs" : { "fill_color" : BLUE, "fill_opacity" : 0.5, @@ -2175,7 +2175,7 @@ class DerivativeOfSineIsSlope(Scene): "\\frac{d(\\sin(\\theta))}{d\\theta} = ", "\\text{Slope of this graph}" ) - tex.scale_to_fit_width(2*SPACE_WIDTH-1) + tex.scale_to_fit_width(2*SPACE_X_RADIUS-1) tex.to_edge(DOWN) VGroup(*tex[0][2:8]).highlight(BLUE) VGroup(*tex[1][-9:]).highlight(BLUE) @@ -2247,7 +2247,7 @@ class IntroduceUnitCircleWithSine(GraphScene): ORIGIN, self.example_radians*self.unit_length*UP, color = YELLOW, ) - line.shift(SPACE_WIDTH*RIGHT/3).to_edge(UP) + line.shift(SPACE_X_RADIUS*RIGHT/3).to_edge(UP) line.insert_n_anchor_points(10) line.make_smooth() @@ -2827,12 +2827,12 @@ class Thumbnail(NudgeSideLengthOfCube): ) VGroup(*formula[:5]).highlight(YELLOW) VGroup(*formula[-3:]).highlight(GREEN_B) - formula.scale_to_fit_width(SPACE_WIDTH-1) + formula.scale_to_fit_width(SPACE_X_RADIUS-1) formula.to_edge(RIGHT) self.add(formula) title = TextMobject("Geometric derivatives") - title.scale_to_fit_width(2*SPACE_WIDTH-1) + title.scale_to_fit_width(2*SPACE_X_RADIUS-1) title.to_edge(UP) self.add(title) diff --git a/old_projects/eoc/chapter4.py b/old_projects/eoc/chapter4.py index ca61f797..a2d9e392 100644 --- a/old_projects/eoc/chapter4.py +++ b/old_projects/eoc/chapter4.py @@ -149,7 +149,7 @@ class TransitionFromLastVideo(TeacherStudentsScene): top_group = VGroup(series, simple_rules, brace) combination_rules.save_state() self.play( - top_group.next_to, SPACE_HEIGHT*UP, UP, + top_group.next_to, SPACE_Y_RADIUS*UP, UP, combination_rules.to_edge, UP, ) pairs = [ @@ -275,7 +275,7 @@ class ComingUp(Scene): def construct(self): rect = Rectangle(height = 9, width = 16) rect.set_stroke(WHITE) - rect.scale_to_fit_height(2*SPACE_HEIGHT-2) + rect.scale_to_fit_height(2*SPACE_Y_RADIUS-2) title = TextMobject("Coming up...") title.to_edge(UP) rect.next_to(title, DOWN) @@ -338,7 +338,7 @@ class SumRule(GraphScene): "y_labeled_nums" : [], "y_axis_label" : "", "x_max" : 4, - "x_axis_width" : 2*SPACE_WIDTH, + "x_axis_width" : 2*SPACE_X_RADIUS, "y_max" : 3, "graph_origin" : 2.5*DOWN + 2.5*LEFT, "graph_label_x_value" : 1.5, @@ -789,7 +789,7 @@ class NotGraphsForProducts(GraphScene): )) words = TextMobject("Not the best visualization") words.scale(1.5) - words.shift(SPACE_HEIGHT*UP/2) + words.shift(SPACE_Y_RADIUS*UP/2) words.add_background_rectangle() words.highlight(RED) self.play( @@ -2291,7 +2291,7 @@ class Thumbnail(IntroduceProductAsArea): blg[1][1].next_to(df_boxes[-1], RIGHT) df_box_labels = self.get_df_box_labels(df_boxes) blg.add(df_boxes, df_box_labels) - blg.scale_to_fit_height(2*SPACE_HEIGHT-2*MED_LARGE_BUFF) + blg.scale_to_fit_height(2*SPACE_Y_RADIUS-2*MED_LARGE_BUFF) blg.center() self.add(blg) diff --git a/old_projects/eoc/chapter5.py b/old_projects/eoc/chapter5.py index 5f02ade3..1fb742fc 100644 --- a/old_projects/eoc/chapter5.py +++ b/old_projects/eoc/chapter5.py @@ -1258,7 +1258,7 @@ class Chapter4Wrapper(Scene): title = TextMobject("Chapter 4 chain rule intuition") title.to_edge(UP) rect = Rectangle(width = 16, height = 9) - rect.scale_to_fit_height(1.5*SPACE_HEIGHT) + rect.scale_to_fit_height(1.5*SPACE_Y_RADIUS) rect.next_to(title, DOWN) self.add(title) @@ -1622,7 +1622,7 @@ class ManyExponentialForms(TeacherStudentsScene): ] group = VGroup(lhs, *rhs_list) group.arrange_submobjects(RIGHT) - group.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + group.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) group.next_to(self.get_pi_creatures(), UP, 2*LARGE_BUFF) for part in group: part.highlight_by_tex("t", YELLOW) diff --git a/old_projects/eoc/chapter6.py b/old_projects/eoc/chapter6.py index 5d32c7e1..79cdb06d 100644 --- a/old_projects/eoc/chapter6.py +++ b/old_projects/eoc/chapter6.py @@ -67,8 +67,8 @@ class ThisWasConfusing(TeacherStudentsScene): class SlopeOfCircleExample(ZoomedScene): CONFIG = { "plane_kwargs" : { - "x_radius" : SPACE_WIDTH/SPACE_UNIT_TO_PLANE_UNIT, - "y_radius" : SPACE_HEIGHT/SPACE_UNIT_TO_PLANE_UNIT, + "x_radius" : SPACE_X_RADIUS/SPACE_UNIT_TO_PLANE_UNIT, + "y_radius" : SPACE_Y_RADIUS/SPACE_UNIT_TO_PLANE_UNIT, "space_unit_to_x_unit" : SPACE_UNIT_TO_PLANE_UNIT, "space_unit_to_y_unit" : SPACE_UNIT_TO_PLANE_UNIT, }, @@ -383,8 +383,8 @@ class SlopeOfCircleExample(ZoomedScene): q_marks.next_to(morty, UP) rect = Rectangle( - width = SPACE_WIDTH - SMALL_BUFF, - height = SPACE_HEIGHT - SMALL_BUFF, + width = SPACE_X_RADIUS - SMALL_BUFF, + height = SPACE_Y_RADIUS - SMALL_BUFF, stroke_width = 0, fill_color = BLACK, fill_opacity = 0.8, @@ -403,7 +403,7 @@ class SlopeOfCircleExample(ZoomedScene): FadeIn(rect), FadeIn(morty), equation.next_to, ORIGIN, DOWN, MED_LARGE_BUFF, - equation.shift, SPACE_WIDTH*RIGHT/2, + equation.shift, SPACE_X_RADIUS*RIGHT/2, ) self.play( morty.change_mode, "confused", @@ -1279,7 +1279,7 @@ class CompareLadderAndCircle(PiCreatureScene, ThreeDScene): circle_scene = LightweightCircleExample() circle_mobs = VGroup(*circle_scene.get_top_level_mobjects()) for mobs, vect in (ladder_mobs, LEFT), (circle_mobs, RIGHT): - mobs.scale_to_fit_height(SPACE_HEIGHT-MED_LARGE_BUFF) + mobs.scale_to_fit_height(SPACE_Y_RADIUS-MED_LARGE_BUFF) mobs.next_to( self.pi_creature.get_corner(UP+vect), UP, buff = SMALL_BUFF, @@ -1446,7 +1446,7 @@ class TwoVariableFunctionAndDerivative(SlopeOfCircleExample): s_expression.next_to(brace, UP, buff = SMALL_BUFF) group = VGroup(equation, s_expression, brace) - group.shift(2*SPACE_WIDTH*LEFT/3) + group.shift(2*SPACE_X_RADIUS*LEFT/3) group.to_edge(UP, buff = MED_SMALL_BUFF) s.save_state() @@ -1582,7 +1582,7 @@ class TwoVariableFunctionAndDerivative(SlopeOfCircleExample): lil_rect.shift(0.05*lil_rect.get_width()*LEFT) lil_rect.shift(0.2*lil_rect.get_height()*DOWN) lil_rect.save_state() - lil_rect.scale_to_fit_height(SPACE_HEIGHT - MED_LARGE_BUFF) + lil_rect.scale_to_fit_height(SPACE_Y_RADIUS - MED_LARGE_BUFF) lil_rect.move_to(s_label, UP) lil_rect.shift(MED_SMALL_BUFF*UP) self.wait() @@ -1885,7 +1885,7 @@ class AlternateExample(ZoomedScene): plane = NumberPlane( space_unit_to_x_unit = 0.75, - x_radius = 2*SPACE_WIDTH, + x_radius = 2*SPACE_X_RADIUS, ) plane.fade() plane.add_coordinates() @@ -2083,7 +2083,7 @@ class AlternateExample(ZoomedScene): mnemonic.highlight_by_tex("d-Right", RED) mnemonic.highlight_by_tex("d-Left", GREEN) mnemonic.add_background_rectangle() - mnemonic.scale_to_fit_width(SPACE_WIDTH-2*MED_LARGE_BUFF) + mnemonic.scale_to_fit_width(SPACE_X_RADIUS-2*MED_LARGE_BUFF) mnemonic.next_to(ORIGIN, UP) mnemonic.to_edge(LEFT) @@ -2093,7 +2093,7 @@ class AlternateExample(ZoomedScene): ) derivative.highlight_by_tex("dx", GREEN) derivative.highlight_by_tex("dy", RED) - derivative.scale_to_fit_width(SPACE_WIDTH - 2*MED_LARGE_BUFF) + derivative.scale_to_fit_width(SPACE_X_RADIUS - 2*MED_LARGE_BUFF) derivative.next_to( brace, DOWN, buff = MED_LARGE_BUFF, @@ -2289,7 +2289,7 @@ class DerivativeOfNaturalLog(ZoomedScene): graph = FunctionGraph( np.log, x_min = 0.01, - x_max = SPACE_WIDTH, + x_max = SPACE_X_RADIUS, num_steps = 100 ) formula = TexMobject("y = \\ln(x)") @@ -2321,7 +2321,7 @@ class DerivativeOfNaturalLog(ZoomedScene): def update_label(label): point = dot.get_center() - vect = point - SPACE_HEIGHT*(DOWN+RIGHT) + vect = point - SPACE_Y_RADIUS*(DOWN+RIGHT) vect = vect/np.linalg.norm(vect) label.move_to( point + vect*0.5*label.get_width() @@ -2358,7 +2358,7 @@ class DerivativeOfNaturalLog(ZoomedScene): def slope_gives_derivative(self): dot = self.dot point = dot.get_center() - line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) slope = 1./point[0] line.rotate(np.arctan(slope)) line.move_to(point) @@ -2562,7 +2562,7 @@ class DerivativeOfNaturalLog(ZoomedScene): graph = FunctionGraph( lambda x : 1./x, x_min = 0.1, - x_max = SPACE_WIDTH, + x_max = SPACE_X_RADIUS, num_steps = 100, color = PINK, ) diff --git a/old_projects/eoc/chapter7.py b/old_projects/eoc/chapter7.py index eb4b017a..83b04f0e 100644 --- a/old_projects/eoc/chapter7.py +++ b/old_projects/eoc/chapter7.py @@ -1155,7 +1155,7 @@ class GraphLimitExpression(GraphScene): delta, limit_x = 0, dashed_line_stroke_width = 3, - dashed_line_length = 2*SPACE_HEIGHT, + dashed_line_length = 2*SPACE_Y_RADIUS, input_range_color = YELLOW, input_range_stroke_width = 6, ): @@ -1239,11 +1239,11 @@ class LimitCounterExample(GraphLimitExpression): "x_min" : -8, "x_max" : 8, "x_labeled_nums" : range(-8, 10, 2), - "x_axis_width" : 2*SPACE_WIDTH - LARGE_BUFF, + "x_axis_width" : 2*SPACE_X_RADIUS - LARGE_BUFF, "y_min" : -4, "y_max" : 4, "y_labeled_nums" : range(-2, 4, 1), - "y_axis_height" : 2*SPACE_HEIGHT+2*LARGE_BUFF, + "y_axis_height" : 2*SPACE_Y_RADIUS+2*LARGE_BUFF, "graph_origin" : DOWN, "graph_color" : BLUE, "hole_radius" : 0.075, @@ -1614,7 +1614,7 @@ class EpsilonDeltaExample(GraphLimitExpression, ZoomedScene): def get_epsilon_group(self, epsilon, limit_value = 12): result = VGroup() - line_length = 2*SPACE_HEIGHT + line_length = 2*SPACE_Y_RADIUS lines = [ Line( ORIGIN, line_length*RIGHT, @@ -1838,12 +1838,12 @@ class TheoryHeavy(TeacherStudentsScene): class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, ReconfigurableScene): CONFIG = { "graph_origin" : ORIGIN, - "x_axis_width" : 2*SPACE_WIDTH, + "x_axis_width" : 2*SPACE_X_RADIUS, "x_min" : -5, "x_max" : 5, "x_labeled_nums" : range(-6, 8, 2), "x_axis_label" : "$x$", - "y_axis_height" : 2*SPACE_HEIGHT, + "y_axis_height" : 2*SPACE_Y_RADIUS, "y_min" : -3.1, "y_max" : 3.1, "y_bottom_tick" : -4, @@ -2028,7 +2028,7 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi rhs = TexMobject("= %.4f\\dots"%result) rhs.next_to(label, RIGHT) approx_group = VGroup(label, rhs) - approx_group.scale_to_fit_width(SPACE_WIDTH-2*MED_LARGE_BUFF) + approx_group.scale_to_fit_width(SPACE_X_RADIUS-2*MED_LARGE_BUFF) approx_group.next_to(ORIGIN, UP, buff = MED_LARGE_BUFF) approx_group.to_edge(RIGHT) @@ -2115,8 +2115,8 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi ) fader = VGroup(*[ Rectangle( - width = 2*SPACE_WIDTH, - height = 2*SPACE_HEIGHT, + width = 2*SPACE_X_RADIUS, + height = 2*SPACE_Y_RADIUS, stroke_width = 0, fill_opacity = 0.75, fill_color = BLACK, @@ -2721,7 +2721,7 @@ class GeneralLHoptial(LHopitalExample): "``", "L'Hôpital's", " rule", "''", arg_separator = "" ) - name.shift(SPACE_WIDTH*RIGHT/2) + name.shift(SPACE_X_RADIUS*RIGHT/2) name.to_edge(UP) self.play(Write(lhs)) diff --git a/old_projects/eoc/chapter8.py b/old_projects/eoc/chapter8.py index 7f420e8d..b61e12ac 100644 --- a/old_projects/eoc/chapter8.py +++ b/old_projects/eoc/chapter8.py @@ -106,7 +106,7 @@ class Chapter8OpeningQuote(OpeningQuote, PiCreatureScene): result.highlight_by_tex("h", GREEN, substring = False) result.highlight_by_tex("d\\theta", GREEN) - result.scale_to_fit_width(2*SPACE_WIDTH - 2*MED_SMALL_BUFF) + result.scale_to_fit_width(2*SPACE_X_RADIUS - 2*MED_SMALL_BUFF) return result class ThisVideo(TeacherStudentsScene): @@ -372,7 +372,7 @@ class Chapter2Wrapper(Scene): title = TextMobject(self.title) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = WHITE) - rect.scale_to_fit_height(1.5*SPACE_HEIGHT) + rect.scale_to_fit_height(1.5*SPACE_Y_RADIUS) rect.next_to(title, DOWN) self.add(title) @@ -1399,7 +1399,7 @@ class CarJourneyApproximation(Scene): def construct(self): points = [5*LEFT + v for v in UP, 2*DOWN] cars = [Car().move_to(point) for point in points] - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) words = [ TextMobject("Real motion (smooth)").shift(3*UP), TextMobject(self.bottom_words).shift(0.5*DOWN), diff --git a/old_projects/eoc/chapter9.py b/old_projects/eoc/chapter9.py index 57eb9f80..85f2e3e7 100644 --- a/old_projects/eoc/chapter9.py +++ b/old_projects/eoc/chapter9.py @@ -607,7 +607,7 @@ class FiniteSample(TryToAddInfinitelyManyPoints): buff = SMALL_BUFF, aligned_edge = DOWN ) - # numerator.scale_to_fit_width(SPACE_WIDTH) + # numerator.scale_to_fit_width(SPACE_X_RADIUS) numerator.scale(0.5) numerator.move_to(self.coords_to_point(3*np.pi/2, 0)) numerator.to_edge(UP) @@ -992,7 +992,7 @@ class IntegralOfSine(FiniteSample): class Approx31(Scene): def construct(self): tex = TexMobject("\\approx 31") - tex.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + tex.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) tex.to_edge(LEFT) self.play(Write(tex)) self.wait(3) @@ -1377,8 +1377,8 @@ class Antiderivative(AverageOfSineStart): fill_color = BLACK, fill_opacity = 0.75, ) - big_rect.scale_to_fit_width(2*SPACE_WIDTH) - big_rect.scale_to_fit_height(2*SPACE_HEIGHT) + big_rect.scale_to_fit_width(2*SPACE_X_RADIUS) + big_rect.scale_to_fit_height(2*SPACE_Y_RADIUS) morty = Mortimer() morty.to_corner(DOWN+RIGHT) @@ -1966,7 +1966,7 @@ class LastVideoWrapper(Scene): title.to_edge(UP) rect = Rectangle(height = 9, width = 16) rect.set_stroke(WHITE) - rect.scale_to_fit_height(1.5*SPACE_HEIGHT) + rect.scale_to_fit_height(1.5*SPACE_Y_RADIUS) rect.next_to(title, DOWN) self.play(Write(title), ShowCreation(rect)) @@ -2146,8 +2146,8 @@ class Thumbnail(GraphScene): fill_color = BLUE_E, fill_opacity = 0.5, ) - triangle.stretch_to_fit_width(2*SPACE_WIDTH) - triangle.stretch_to_fit_height(2*SPACE_HEIGHT) + triangle.stretch_to_fit_width(2*SPACE_X_RADIUS) + triangle.stretch_to_fit_height(2*SPACE_Y_RADIUS) triangle.to_corner(UP+LEFT, buff = 0) alt_triangle = triangle.copy() diff --git a/old_projects/eoc/footnote.py b/old_projects/eoc/footnote.py index 38b2da94..7384fa98 100644 --- a/old_projects/eoc/footnote.py +++ b/old_projects/eoc/footnote.py @@ -766,7 +766,7 @@ class SecondDerivativeAsAcceleration(Scene): for scene in s_scene, v_scene, a_scene, j_scene ] for i, graph in enumerate(graphs): - graph.scale_to_fit_height(SPACE_HEIGHT) + graph.scale_to_fit_height(SPACE_Y_RADIUS) graph.to_corner(UP+LEFT) graph.shift(i*DOWN/2.0) diff --git a/old_projects/eoc/old_chapter1.py b/old_projects/eoc/old_chapter1.py index 38d642f5..703d7637 100644 --- a/old_projects/eoc/old_chapter1.py +++ b/old_projects/eoc/old_chapter1.py @@ -245,7 +245,7 @@ class Introduction(TeacherStudentsScene): this_video.save_state() this_video.set_fill(opacity = 0) this_video.center() - this_video.scale_to_fit_height(2*SPACE_HEIGHT) + this_video.scale_to_fit_height(2*SPACE_Y_RADIUS) self.this_video = this_video words = TextMobject( @@ -276,7 +276,7 @@ class Introduction(TeacherStudentsScene): ] ) def homotopy(x, y, z, t): - alpha = (0.7*x + SPACE_WIDTH)/(2*SPACE_WIDTH) + alpha = (0.7*x + SPACE_X_RADIUS)/(2*SPACE_X_RADIUS) beta = squish_rate_func(smooth, alpha-0.15, alpha+0.15)(t) return (x, y - 0.3*np.sin(np.pi*beta), z) self.play( @@ -372,7 +372,7 @@ class Introduction(TeacherStudentsScene): this_video = self.this_video self.remove(this_video) this_video.generate_target() - this_video.target.scale_to_fit_height(2*SPACE_HEIGHT) + this_video.target.scale_to_fit_height(2*SPACE_Y_RADIUS) this_video.target.center() this_video.target.set_fill(opacity = 0) @@ -633,8 +633,8 @@ class IntroduceTinyChangeInArea(CircleScene): self.wait() big_rect = Rectangle( - width = 2*SPACE_WIDTH, - height = 2*SPACE_HEIGHT, + width = 2*SPACE_X_RADIUS, + height = 2*SPACE_Y_RADIUS, fill_color = BLACK, fill_opacity = 0.85, stroke_width = 0, @@ -1558,7 +1558,7 @@ class DerivativeAsTangentLine(ZoomedScene): def show_tangent_lines(self): R = self.R_to_zoom_in_on - line = Line(LEFT, RIGHT).scale(SPACE_HEIGHT) + line = Line(LEFT, RIGHT).scale(SPACE_Y_RADIUS) line.highlight(MAROON_B) line.rotate(self.angle_of_tangent(R)) line.move_to(self.graph_point(R)) @@ -2489,7 +2489,7 @@ class CalculusInANutshell(CircleScene): first.set_fill(YELLOW) first.save_state() first.center() - first.scale_to_fit_height(SPACE_HEIGHT*2) + first.scale_to_fit_height(SPACE_Y_RADIUS*2) first.set_fill(opacity = 0) everything = VGroup(*self.get_mobjects()) everything.generate_target() diff --git a/old_projects/eola/chapter0.py b/old_projects/eola/chapter0.py index be09e132..3a991ae9 100644 --- a/old_projects/eola/chapter0.py +++ b/old_projects/eola/chapter0.py @@ -59,7 +59,7 @@ class OpeningQuote(Scene): """, organize_left_to_right = False ) - words.scale_to_fit_width(2*(SPACE_WIDTH-1)) + words.scale_to_fit_width(2*(SPACE_X_RADIUS-1)) words.to_edge(UP) for mob in words.submobjects[48:49+13]: mob.highlight(GREEN) @@ -76,7 +76,7 @@ class VideoIcon(SVGMobject): def __init__(self, **kwargs): SVGMobject.__init__(self, "video_icon", **kwargs) self.center() - self.scale_to_fit_width(2*SPACE_WIDTH/12.) + self.scale_to_fit_width(2*SPACE_X_RADIUS/12.) self.set_stroke(color = WHITE, width = 0) self.set_fill(color = WHITE, opacity = 1) @@ -271,11 +271,11 @@ class NumericVsGeometric(Scene): geometric = TextMobject("Geometric intuition") for mob in numeric, geometric: mob.to_corner(UP+LEFT) - geometric.shift(SPACE_WIDTH*RIGHT) - hline = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + geometric.shift(SPACE_X_RADIUS*RIGHT) + hline = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) hline.next_to(numeric, DOWN) hline.to_edge(LEFT, buff = 0) - vline = Line(SPACE_HEIGHT*UP, SPACE_HEIGHT*DOWN) + vline = Line(SPACE_Y_RADIUS*UP, SPACE_Y_RADIUS*DOWN) for mob in hline, vline: mob.highlight(GREEN) @@ -294,7 +294,7 @@ class NumericVsGeometric(Scene): "\\\\ &=", matrix_to_tex_string([[1], [-1]]), ])) - matrix_vector_product.scale_to_fit_width(SPACE_WIDTH-0.5) + matrix_vector_product.scale_to_fit_width(SPACE_X_RADIUS-0.5) matrix_vector_product.next_to(self.vline, LEFT) self.play( @@ -309,15 +309,15 @@ class NumericVsGeometric(Scene): digest_locals(self) def clear_way_for_geometric(self): - new_line = Line(SPACE_HEIGHT*LEFT, SPACE_HEIGHT*RIGHT) - new_line.shift((SPACE_HEIGHT+1)*DOWN) + new_line = Line(SPACE_Y_RADIUS*LEFT, SPACE_Y_RADIUS*RIGHT) + new_line.shift((SPACE_Y_RADIUS+1)*DOWN) self.play( Transform(self.vline, new_line), Transform(self.hline, new_line), - ApplyMethod(self.numeric.shift, (2*SPACE_HEIGHT+1)*DOWN), + ApplyMethod(self.numeric.shift, (2*SPACE_Y_RADIUS+1)*DOWN), ApplyMethod( self.matrix_vector_product.shift, - (2*SPACE_HEIGHT+1)*DOWN + (2*SPACE_Y_RADIUS+1)*DOWN ), ApplyMethod(self.geometric.to_edge, LEFT) ) @@ -671,7 +671,7 @@ class LinearAlgebraIntuitions(Scene): def construct(self): title = TextMobject("Preview of core visual intuitions") title.to_edge(UP) - h_line = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + h_line = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) h_line.next_to(title, DOWN) h_line.highlight(BLUE_E) intuitions = [ @@ -832,7 +832,7 @@ class TableOfContents(Scene): title = TextMobject("Essence of Linear Algebra") title.highlight(BLUE) title.to_corner(UP+LEFT) - h_line = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + h_line = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) h_line.next_to(title, DOWN) h_line.to_edge(LEFT, buff = 0) chapters = VMobject(*map(TextMobject, [ @@ -884,7 +884,7 @@ class TableOfContents(Scene): def series_of_videos(self, chapters): icon = SVGMobject("video_icon") icon.center() - icon.scale_to_fit_width(2*SPACE_WIDTH/12.) + icon.scale_to_fit_width(2*SPACE_X_RADIUS/12.) icon.set_stroke(color = WHITE, width = 0) icons = [icon.copy() for chapter in chapters.split()] colors = Color(BLUE_A).range_to(BLUE_D, len(icons)) diff --git a/old_projects/eola/chapter1.py b/old_projects/eola/chapter1.py index 6dd2abf9..1f0edf63 100644 --- a/old_projects/eola/chapter1.py +++ b/old_projects/eola/chapter1.py @@ -28,7 +28,7 @@ import random def plane_wave_homotopy(x, y, z, t): norm = np.linalg.norm([x, y]) - tau = interpolate(5, -5, t) + norm/SPACE_WIDTH + tau = interpolate(5, -5, t) + norm/SPACE_X_RADIUS alpha = sigmoid(tau) return [x, y + 0.5*np.sin(2*np.pi*alpha)-t*SMALL_BUFF/2, z] @@ -299,7 +299,7 @@ class DifferentConceptions(Scene): house, square_footage, price, brackets, brace, two_dimensional, title ) - self.play(ApplyMethod(everything.shift, 2*SPACE_WIDTH*LEFT)) + self.play(ApplyMethod(everything.shift, 2*SPACE_X_RADIUS*LEFT)) self.remove(everything) @@ -1101,10 +1101,10 @@ class FollowingVideos(UpcomingSeriesOfVidoes): everything.remove(last_video) big_last_video = last_video.copy() big_last_video.center() - big_last_video.scale_to_fit_height(2.5*SPACE_HEIGHT) + big_last_video.scale_to_fit_height(2.5*SPACE_Y_RADIUS) big_last_video.set_fill(opacity = 0) self.play( - ApplyMethod(everything.shift, 2*SPACE_WIDTH*LEFT), + ApplyMethod(everything.shift, 2*SPACE_X_RADIUS*LEFT), Transform(last_video, big_last_video), run_time = 2 ) diff --git a/old_projects/eola/chapter10.py b/old_projects/eola/chapter10.py index b1c65eb2..e6cbc674 100644 --- a/old_projects/eola/chapter10.py +++ b/old_projects/eola/chapter10.py @@ -42,7 +42,7 @@ class OpeningQuote(Scene): ) words.highlight_by_tex("mathematics", BLUE) words.highlight_by_tex("music", BLUE) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) author = TextMobject("-Serge Lang") author.highlight(YELLOW) @@ -127,13 +127,13 @@ class ManyPrerequisites(Scene): def construct(self): title = TextMobject("Many prerequisites") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title) self.play(ShowCreation(h_line)) rect = Rectangle(height = 9, width = 16, color = BLUE) - rect.scale_to_fit_width(SPACE_WIDTH-2) + rect.scale_to_fit_width(SPACE_X_RADIUS-2) rects = [rect]+[rect.copy() for i in range(3)] words = [ "Linear transformations", @@ -148,7 +148,7 @@ class ManyPrerequisites(Scene): Matrix(np.array(rects).reshape((2, 2))) rects = VGroup(*rects) - rects.scale_to_fit_height(2*SPACE_HEIGHT - 1.5) + rects.scale_to_fit_height(2*SPACE_Y_RADIUS - 1.5) rects.next_to(h_line, DOWN, buff = MED_SMALL_BUFF) self.play(Write(rects[0])) @@ -290,7 +290,7 @@ class IHatAsEigenVector(ExampleTranformationScene): x_axis = self.plane.axes[0] targets = [ self.i_hat.copy().scale(val) - for val in -SPACE_WIDTH, SPACE_WIDTH, 1 + for val in -SPACE_X_RADIUS, SPACE_X_RADIUS, 1 ] lines = [ Line(v1.get_end(), v2.get_end(), color = YELLOW) @@ -329,7 +329,7 @@ class AllXAxisVectorsAreEigenvectors(ExampleTranformationScene): def construct(self): vectors = VGroup(*[ self.add_vector(u*x*RIGHT, animate = False) - for x in reversed(range(1, int(SPACE_WIDTH)+1)) + for x in reversed(range(1, int(SPACE_X_RADIUS)+1)) for u in -1, 1 ]) vectors.gradient_highlight(YELLOW, X_COLOR) @@ -411,14 +411,14 @@ class NameEigenvectorsAndEigenvalues(ExampleTranformationScene): self.foreground_mobjects.remove(self.matrix) x_vectors = VGroup(*[ self.add_vector(u*x*RIGHT, animate = False) - for x in range(int(SPACE_WIDTH)+1, 0, -1) + for x in range(int(SPACE_X_RADIUS)+1, 0, -1) for u in -1, 1 ]) x_vectors.gradient_highlight(YELLOW, X_COLOR) self.remove(x_vectors) sneak_vectors = VGroup(*[ self.add_vector(u*x*(LEFT+UP), animate = False) - for x in np.arange(int(SPACE_HEIGHT), 0, -0.5) + for x in np.arange(int(SPACE_Y_RADIUS), 0, -0.5) for u in -1, 1 ]) sneak_vectors.gradient_highlight(MAROON_B, YELLOW) @@ -452,8 +452,8 @@ class NameEigenvectorsAndEigenvalues(ExampleTranformationScene): non_eigen = Vector([1, 1], color = PINK) non_eigen_span = Line( - -SPACE_HEIGHT*non_eigen.get_end(), - SPACE_HEIGHT*non_eigen.get_end(), + -SPACE_Y_RADIUS*non_eigen.get_end(), + SPACE_Y_RADIUS*non_eigen.get_end(), color = RED ) non_eigen_words = TextMobject(""" @@ -504,8 +504,8 @@ class EigenvalueNegativeOneHalf(LinearTransformationScene): CONFIG = { "t_matrix" : [[0.5, -1], [-1, 0.5]], "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, "include_background_plane" : False @@ -523,8 +523,8 @@ class EigenvalueNegativeOneHalf(LinearTransformationScene): words.add_background_rectangle() words.next_to(vector.get_end(), RIGHT) span = Line( - -SPACE_HEIGHT*vector.get_end(), - SPACE_HEIGHT*vector.get_end(), + -SPACE_Y_RADIUS*vector.get_end(), + SPACE_Y_RADIUS*vector.get_end(), color = MAROON_B ) @@ -1029,8 +1029,8 @@ class TweakLambda(LinearTransformationScene): "t_matrix" : [[2, 1], [2, 3]], "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 1 }, } @@ -1155,8 +1155,8 @@ class ShowEigenVectorAfterComputing(LinearTransformationScene): "v_coords" : [2, -1], "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 1 }, } @@ -1624,7 +1624,7 @@ class SolveRotationEigenvalues(Rotate90Degrees): transformation. """, alignment = "") interesting_tidbit.add_background_rectangle() - interesting_tidbit.scale_to_fit_height(SPACE_HEIGHT-0.5) + interesting_tidbit.scale_to_fit_height(SPACE_Y_RADIUS-0.5) interesting_tidbit.to_corner(DOWN+RIGHT) self.play(FadeIn(interesting_tidbit)) self.wait() @@ -1634,8 +1634,8 @@ class ShearExample(RevisitExampleTransformation): "t_matrix" : [[1, 0], [1, 1]], "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, } @@ -1655,7 +1655,7 @@ class ShearExample(RevisitExampleTransformation): def point_out_eigenvectors(self): vectors = VGroup(*[ self.add_vector(u*x*RIGHT, animate = False) - for x in range(int(SPACE_WIDTH)+1, 0, -1) + for x in range(int(SPACE_X_RADIUS)+1, 0, -1) for u in -1, 1 ]) vectors.gradient_highlight(YELLOW, X_COLOR) @@ -2115,8 +2115,8 @@ class ChangeToEigenBasis(ExampleTranformationScene): "show_basis_vectors" : False, "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 0 }, } diff --git a/old_projects/eola/chapter11.py b/old_projects/eola/chapter11.py index a38e682f..d2c8315b 100644 --- a/old_projects/eola/chapter11.py +++ b/old_projects/eola/chapter11.py @@ -62,7 +62,7 @@ class OpeningQuote(Scene): ) words.highlight_by_tex("axioms,", BLUE) words.highlight_by_tex("difficult for the uninitiated", RED) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) author = TextMobject("-Vladmir Arnold") author.highlight(YELLOW) @@ -96,8 +96,8 @@ class WhatIsA2DVector(LinearTransformationScene): "show_basis_vectors" : False, "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, } @@ -340,8 +340,8 @@ class ManyCoordinateSystems(LinearTransformationScene): "v_coords" : [2, 1], "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 1 }, } @@ -422,8 +422,8 @@ class DeterminantAndEigenvectorDontCare(LinearTransformationScene): "include_background_plane" : False, "show_basis_vectors" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, } @@ -679,7 +679,7 @@ class AddTwoFunctions(FunctionGraphScene): curr_x_point = f_lines[0].get_start() sum_def = self.get_sum_definition(DecimalNumber(curr_x_point[0])) - # sum_def.scale_to_fit_width(SPACE_WIDTH-1) + # sum_def.scale_to_fit_width(SPACE_X_RADIUS-1) sum_def.to_corner(UP+LEFT) arrow = Arrow(sum_def[2].get_bottom(), curr_x_point, color = WHITE) prefix = sum_def[0] @@ -924,7 +924,7 @@ class FromVectorsToFunctions(VectorScene): def bring_in_functions(self): everything = VGroup(*self.get_mobjects()) axes = Axes() - axes.shift(2*SPACE_WIDTH*LEFT) + axes.shift(2*SPACE_X_RADIUS*LEFT) fg_scene_config = FunctionGraphScene.CONFIG graph = FunctionGraph(fg_scene_config["default_functions"][0]) @@ -952,7 +952,7 @@ class FromVectorsToFunctions(VectorScene): )) self.wait() self.play(*[ - ApplyMethod(mob.shift, 2*SPACE_WIDTH*RIGHT) + ApplyMethod(mob.shift, 2*SPACE_X_RADIUS*RIGHT) for mob in axes, everything ] + [Animation(words)] ) @@ -1055,8 +1055,8 @@ class ManyFunctions(FunctionGraphScene): def func(x): return sum([c*x**(i) for i, c, in enumerate(coefs)]) graph = self.get_function_graph(func, animate = False) - if graph.get_height() > 2*SPACE_HEIGHT: - graph.stretch_to_fit_height(2*SPACE_HEIGHT) + if graph.get_height() > 2*SPACE_Y_RADIUS: + graph.stretch_to_fit_height(2*SPACE_Y_RADIUS) graph.shift(graph.point_from_proportion(0.5)[1]*DOWN) graph.shift(interpolate(-3, 3, random.random())*UP) graph.highlight(random_bright_color()) @@ -1086,8 +1086,8 @@ class FormalDefinitionOfLinear(LinearTransformationScene): "w_coords" : [1, 1], "v_coords" : [1, -2], "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, } @@ -1104,7 +1104,7 @@ class FormalDefinitionOfLinear(LinearTransformationScene): ) title.add_background_rectangle() title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) v_tex, w_tex = ["\\vec{\\textbf{%s}}"%s for s in "vw"] @@ -1449,7 +1449,7 @@ class PolynomialsHaveArbitrarilyLargeDegree(Scene): arrow = TexMobject("\\Rightarrow").scale(1.5) brace = Brace( - Line(UP, DOWN).scale(SPACE_HEIGHT).shift(SPACE_WIDTH*RIGHT), + Line(UP, DOWN).scale(SPACE_Y_RADIUS).shift(SPACE_X_RADIUS*RIGHT), LEFT ) words = TextMobject("Infinitely many") @@ -1936,12 +1936,12 @@ class CompareTermsInLinearAlgebraToFunction(Scene): r_title = TextMobject("Alternate names when \\\\ applied to functions") for title, vect in (l_title, LEFT), (r_title, RIGHT): title.to_edge(UP) - title.shift(vect*SPACE_WIDTH/2) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + title.shift(vect*SPACE_X_RADIUS/2) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.shift( VGroup(l_title, r_title).get_bottom()[1]*UP + SMALL_BUFF*DOWN ) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) VGroup(h_line, v_line).highlight(BLUE) self.add(l_title, r_title) @@ -1961,7 +1961,7 @@ class CompareTermsInLinearAlgebraToFunction(Scene): for concepts, vect in (lin_alg_concepts, LEFT), (function_concepts, RIGHT): concepts.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT) concepts.next_to(h_line, DOWN, buff = LARGE_BUFF) - concepts.shift(vect*SPACE_WIDTH/2) + concepts.shift(vect*SPACE_X_RADIUS/2) concepts.gradient_highlight(YELLOW_B, YELLOW_C) for concept in concepts: @@ -2049,20 +2049,20 @@ class ShowVectorSpaces(Scene): def construct(self): title = TextMobject("Vector spaces") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) v_lines = [ Line( - h_line.get_center(), SPACE_HEIGHT*DOWN - ).shift(vect*SPACE_WIDTH/3.) + h_line.get_center(), SPACE_Y_RADIUS*DOWN + ).shift(vect*SPACE_X_RADIUS/3.) for vect in LEFT, RIGHT ] vectors = self.get_vectors() - vectors.shift(LEFT*SPACE_WIDTH*(2./3)) + vectors.shift(LEFT*SPACE_X_RADIUS*(2./3)) arrays = self.get_arrays() functions = self.get_functions() - functions.shift(RIGHT*SPACE_WIDTH*(2./3)) + functions.shift(RIGHT*SPACE_X_RADIUS*(2./3)) self.add(h_line, *v_lines) self.play(ShowCreation( @@ -2112,7 +2112,7 @@ class ShowVectorSpaces(Scene): lambda x : x**2 - 1, ] ]) - functions.stretch_to_fit_width(SPACE_WIDTH/2.) + functions.stretch_to_fit_width(SPACE_X_RADIUS/2.) functions.stretch_to_fit_height(6) functions.gradient_highlight(YELLOW, MAROON_B) functions.center() @@ -2185,7 +2185,7 @@ class ListAxioms(Scene): def construct(self): title = TextMobject("Rules for vectors addition and scaling") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title, h_line) @@ -2244,7 +2244,7 @@ class ListAxioms(Scene): DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT ) - axioms.scale_to_fit_width(2*SPACE_WIDTH-1) + axioms.scale_to_fit_width(2*SPACE_X_RADIUS-1) axioms.next_to(h_line, DOWN, buff = MED_SMALL_BUFF) self.play(FadeIn( @@ -2256,7 +2256,7 @@ class ListAxioms(Scene): axioms_word = TextMobject("``Axioms''") axioms_word.highlight(YELLOW) axioms_word.scale(2) - axioms_word.shift(SPACE_WIDTH*RIGHT/2, SPACE_HEIGHT*DOWN/2) + axioms_word.shift(SPACE_X_RADIUS*RIGHT/2, SPACE_Y_RADIUS*DOWN/2) self.play(Write(axioms_word, run_time = 3)) self.wait() @@ -2324,7 +2324,7 @@ class VectorSpaceOfPiCreatures(Scene): for y in range(4) ]).arrange_submobjects(DOWN, buff = 1.5) creatures = VGroup(*it.chain(*creatures)) - creatures.scale_to_fit_height(2*SPACE_HEIGHT-1) + creatures.scale_to_fit_height(2*SPACE_Y_RADIUS-1) for pi in creatures: pi.change_mode(random.choice([ "pondering", "pondering", diff --git a/old_projects/eola/chapter2.py b/old_projects/eola/chapter2.py index 8a4575d4..8a2da442 100644 --- a/old_projects/eola/chapter2.py +++ b/old_projects/eola/chapter2.py @@ -206,7 +206,7 @@ class CoordinatesAsScalarsExample2(CoordinatesAsScalars): are the ``basis vectors'' \\\\ of the $xy$ coordinate system """) - text.scale_to_fit_width(SPACE_WIDTH-1) + text.scale_to_fit_width(SPACE_X_RADIUS-1) text.to_corner(UP+RIGHT) VMobject(*text.split()[:2]).highlight(X_COLOR) VMobject(*text.split()[5:7]).highlight(Y_COLOR) @@ -460,7 +460,7 @@ class NameLinearCombinations(Scene): ]) words.split()[1].highlight(v_color) words.split()[3].highlight(w_color) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(UP) equation = TexMobject([ @@ -601,7 +601,7 @@ class DefineSpan(Scene): $\\vec{\\textbf{w}}$ is the \\\\ set of all their linear combinations. """) - definition.scale_to_fit_width(2*SPACE_WIDTH-1) + definition.scale_to_fit_width(2*SPACE_X_RADIUS-1) definition.to_edge(UP) def_mobs = np.array(definition.split()) VMobject(*def_mobs[4:4+4]).highlight(PINK) @@ -708,7 +708,7 @@ class VectorsOnALine(VectorsToDotsScene): return [ Vector(a*np.array([1.5, 1])) for a in np.linspace( - -SPACE_HEIGHT, SPACE_HEIGHT, self.num_vectors + -SPACE_Y_RADIUS, SPACE_Y_RADIUS, self.num_vectors ) ] @@ -732,18 +732,18 @@ class VectorsInThePlane(VectorsToDotsScene): def get_vectors(self): return [ Vector([x, y]) - for x in np.arange(-int(SPACE_WIDTH)-0.5, int(SPACE_WIDTH)+0.5) - for y in np.arange(-int(SPACE_HEIGHT)-0.5, int(SPACE_HEIGHT)+0.5) + for x in np.arange(-int(SPACE_X_RADIUS)-0.5, int(SPACE_X_RADIUS)+0.5) + for y in np.arange(-int(SPACE_Y_RADIUS)-0.5, int(SPACE_Y_RADIUS)+0.5) ] def play_final_animation(self, vectors, rate_functions): h_line = Line( - SPACE_WIDTH*RIGHT, SPACE_WIDTH*LEFT, + SPACE_X_RADIUS*RIGHT, SPACE_X_RADIUS*LEFT, stroke_width = 0.5, color = BLUE_E ) v_line = Line( - SPACE_HEIGHT*UP, SPACE_HEIGHT*DOWN, + SPACE_Y_RADIUS*UP, SPACE_Y_RADIUS*DOWN, stroke_width = 0.5, color = BLUE_E ) @@ -834,7 +834,7 @@ class LinearCombinationOfThreeVectorsText(Scene): VMobject(*text.split()[-9:-7]).highlight(BLUE) VMobject(*text.split()[-3:-1]).highlight(RED_C) VMobject(*text.split()[:17]).highlight(GREEN) - text.scale_to_fit_width(2*SPACE_WIDTH - 1) + text.scale_to_fit_width(2*SPACE_X_RADIUS - 1) text.to_edge(UP) equation = TextMobject("""$ @@ -896,7 +896,7 @@ class SpanCasesWords(Scene): VMobject(*words2.split()[10:13]).highlight(RED) for words in words1, words2: - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) self.play(Write(words1)) self.wait() self.play(Transform(words1, words2)) @@ -933,7 +933,7 @@ class LinearDependentWords(Scene): rest.highlight(YELLOW) for words in words1, words2: - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) self.play(Write(words1)) self.wait() @@ -1253,7 +1253,7 @@ class TechnicalDefinitionOfBasis(Scene): b.highlight(BLUE) li.highlight(GREEN) s.highlight(YELLOW) - definition.scale_to_fit_width(2*SPACE_WIDTH-1) + definition.scale_to_fit_width(2*SPACE_X_RADIUS-1) self.add(title) self.play(Write(definition)) diff --git a/old_projects/eola/chapter3.py b/old_projects/eola/chapter3.py index 345cd83a..8b5e7c52 100644 --- a/old_projects/eola/chapter3.py +++ b/old_projects/eola/chapter3.py @@ -33,7 +33,7 @@ class OpeningQuote(Scene): "is. You have to", "see it for yourself.", ]) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) words.split()[1].highlight(GREEN) words.split()[3].highlight(BLUE) @@ -71,7 +71,7 @@ class Introduction(TeacherStudentsScene): everything = VMobject(*self.get_mobjects()) def spread_out(p): p = p + 2*DOWN - return (SPACE_WIDTH+SPACE_HEIGHT)*p/np.linalg.norm(p) + return (SPACE_X_RADIUS+SPACE_Y_RADIUS)*p/np.linalg.norm(p) self.play( ApplyPointwiseFunction(spread_out, everything), ApplyFunction( @@ -216,7 +216,7 @@ class ThinkinfOfFunctionsAsGraphs(VectorScene): self.wait() def collapse_func(p): - return np.dot(p, [RIGHT, RIGHT, OUT]) + (SPACE_HEIGHT+1)*DOWN + return np.dot(p, [RIGHT, RIGHT, OUT]) + (SPACE_Y_RADIUS+1)*DOWN self.play( ApplyPointwiseFunction(collapse_func, axes), ApplyPointwiseFunction(collapse_func, graph), @@ -267,8 +267,8 @@ class TransformManyVectors(LinearTransformationScene): self.lock_in_faded_grid() vectors = VMobject(*[ Vector([x, y]) - for x in np.arange(-int(SPACE_WIDTH)+0.5, int(SPACE_WIDTH)+0.5) - for y in np.arange(-int(SPACE_HEIGHT)+0.5, int(SPACE_HEIGHT)+0.5) + for x in np.arange(-int(SPACE_X_RADIUS)+0.5, int(SPACE_X_RADIUS)+0.5) + for y in np.arange(-int(SPACE_Y_RADIUS)+0.5, int(SPACE_Y_RADIUS)+0.5) ]) vectors.submobject_gradient_highlight(PINK, YELLOW) t_matrix = self.transposed_matrix @@ -325,8 +325,8 @@ class TransformInfiniteGrid(LinearTransformationScene): CONFIG = { "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, }, "show_basis_vectors" : False } @@ -343,8 +343,8 @@ class TransformInfiniteGridWithBackground(TransformInfiniteGrid): CONFIG = { "include_background_plane" : True, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 0 }, @@ -355,8 +355,8 @@ class ApplyComplexFunction(LinearTransformationScene): "function" : lambda z : 0.5*z**2, "show_basis_vectors" : False, "foreground_plane_kwargs" : { - "x_radius" : SPACE_WIDTH, - "y_radius" : SPACE_HEIGHT, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : SPACE_Y_RADIUS, "secondary_line_ratio" : 0 }, } @@ -507,8 +507,8 @@ class SneakyNonlinearTransformation(SimpleNonlinearTransformationScene): } def func(self, point): x, y, z = point - new_x = np.sign(x)*SPACE_WIDTH*smooth(abs(x) / SPACE_WIDTH) - new_y = np.sign(y)*SPACE_HEIGHT*smooth(abs(y) / SPACE_HEIGHT) + new_x = np.sign(x)*SPACE_X_RADIUS*smooth(abs(x) / SPACE_X_RADIUS) + new_y = np.sign(y)*SPACE_Y_RADIUS*smooth(abs(y) / SPACE_Y_RADIUS) return [new_x, new_y, 0] class SneakyNonlinearTransformationExplained(SneakyNonlinearTransformation): @@ -518,8 +518,8 @@ class SneakyNonlinearTransformationExplained(SneakyNonlinearTransformation): def setup(self): LinearTransformationScene.setup(self) diag = Line( - SPACE_HEIGHT*LEFT+SPACE_HEIGHT*DOWN, - SPACE_HEIGHT*RIGHT + SPACE_HEIGHT*UP + SPACE_Y_RADIUS*LEFT+SPACE_Y_RADIUS*DOWN, + SPACE_Y_RADIUS*RIGHT + SPACE_Y_RADIUS*UP ) diag.insert_n_anchor_points(20) diag.change_anchor_mode("smooth") @@ -788,8 +788,8 @@ class WatchManyVectorsMove(TransformManyVectors): self.setup() vectors = VMobject(*[ Vector([x, y]) - for x in np.arange(-int(SPACE_WIDTH)+0.5, int(SPACE_WIDTH)+0.5) - for y in np.arange(-int(SPACE_HEIGHT)+0.5, int(SPACE_HEIGHT)+0.5) + for x in np.arange(-int(SPACE_X_RADIUS)+0.5, int(SPACE_X_RADIUS)+0.5) + for y in np.arange(-int(SPACE_Y_RADIUS)+0.5, int(SPACE_Y_RADIUS)+0.5) ]) vectors.submobject_gradient_highlight(PINK, YELLOW) dots = self.vectors_to_dots(vectors) @@ -1327,7 +1327,7 @@ class FinalSlide(Scene): definition is actually equivalent to the two properties above. """, enforce_new_line_structure = False) - text.scale_to_fit_height(2*SPACE_HEIGHT - 2) + text.scale_to_fit_height(2*SPACE_Y_RADIUS - 2) text.to_edge(UP) self.add(text) self.wait() @@ -1421,7 +1421,7 @@ class UsedToThinkinfOfFunctionsAsGraphs(VectorScene): self.wait() def collapse_func(p): - return np.dot(p, [RIGHT, RIGHT, OUT]) + (SPACE_HEIGHT+1)*DOWN + return np.dot(p, [RIGHT, RIGHT, OUT]) + (SPACE_Y_RADIUS+1)*DOWN self.play( ApplyPointwiseFunction( collapse_func, axes, @@ -1648,8 +1648,8 @@ class MoveAroundAllVectors(LinearTransformationScene): self.setup() vectors = VMobject(*[ Vector([x, y]) - for x in np.arange(-int(SPACE_WIDTH)+0.5, int(SPACE_WIDTH)+0.5) - for y in np.arange(-int(SPACE_HEIGHT)+0.5, int(SPACE_HEIGHT)+0.5) + for x in np.arange(-int(SPACE_X_RADIUS)+0.5, int(SPACE_X_RADIUS)+0.5) + for y in np.arange(-int(SPACE_Y_RADIUS)+0.5, int(SPACE_Y_RADIUS)+0.5) ]) vectors.submobject_gradient_highlight(PINK, YELLOW) dots = self.get_dots(vectors) diff --git a/old_projects/eola/chapter4.py b/old_projects/eola/chapter4.py index a31da52e..d9061ed2 100644 --- a/old_projects/eola/chapter4.py +++ b/old_projects/eola/chapter4.py @@ -31,7 +31,7 @@ class OpeningQuote(Scene): "can be shortened by 50\\% if one", "throws the matrices out." ]) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) words.split()[1].highlight(GREEN) words.split()[3].highlight(BLUE) @@ -235,8 +235,8 @@ class RecapOver(TeacherStudentsScene): class TwoSuccessiveTransformations(LinearTransformationScene): CONFIG = { "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -249,8 +249,8 @@ class TwoSuccessiveTransformations(LinearTransformationScene): class RotationThenShear(LinearTransformationScene): CONFIG = { "foreground_plane_kwargs" : { - "x_radius" : SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -817,8 +817,8 @@ class FirstShearThenRotation(LinearTransformationScene): "t_matrix1" : [[1, 0], [1, 1]], "t_matrix2" : [[0, 1], [-1, 0]], "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -1078,7 +1078,7 @@ class NextVideo(Scene): title = TextMobject(""" Next video: Linear transformations in three dimensions """) - title.scale_to_fit_width(2*SPACE_WIDTH - 2) + title.scale_to_fit_width(2*SPACE_X_RADIUS - 2) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = BLUE) rect.scale_to_fit_height(6) diff --git a/old_projects/eola/chapter5.py b/old_projects/eola/chapter5.py index f5039b21..49c49eb3 100644 --- a/old_projects/eola/chapter5.py +++ b/old_projects/eola/chapter5.py @@ -88,7 +88,7 @@ class OpeningQuote(Scene): "numbers.", "''", ], arg_separator = "") - # words.scale_to_fit_width(2*SPACE_WIDTH - 2) + # words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) words.split()[1].highlight(BLUE) words.split()[3].highlight(GREEN) @@ -131,8 +131,8 @@ class StretchingTransformation(LinearTransformationScene): class SquishingTransformation(LinearTransformationScene): CONFIG = { "foreground_plane_kwargs" : { - "x_radius" : 3*SPACE_WIDTH, - "y_radius" : 3*SPACE_WIDTH, + "x_radius" : 3*SPACE_X_RADIUS, + "y_radius" : 3*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -430,8 +430,8 @@ class DeterminantIsOneHalf(NameDeterminant): CONFIG = { "t_matrix" : [[0.5, -0.5], [0.5, 0.5]], "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -451,7 +451,7 @@ class NextFewVideos(Scene): def construct(self): icon = SVGMobject("video_icon") icon.center() - icon.scale_to_fit_width(2*SPACE_WIDTH/12.) + icon.scale_to_fit_width(2*SPACE_X_RADIUS/12.) icon.set_stroke(color = WHITE, width = 0) icon.set_fill(WHITE, opacity = 1) icons = VMobject(*[icon.copy() for x in range(10)]) @@ -511,9 +511,9 @@ class NegativeDeterminant(Scene): class FlipSpaceOver(Scene): def construct(self): - plane1 = NumberPlane(y_radius = SPACE_WIDTH) + plane1 = NumberPlane(y_radius = SPACE_X_RADIUS) plane2 = NumberPlane( - y_radius = SPACE_WIDTH, + y_radius = SPACE_X_RADIUS, color = RED_D, secondary_color = RED_E ) axis = UP @@ -1057,7 +1057,7 @@ class FullFormulaExplanation(LinearTransformationScene): formula.next_to(det_text, RIGHT) everyone = VMobject(det_text, matrix, formula) - everyone.scale_to_fit_width(2*SPACE_WIDTH - 1) + everyone.scale_to_fit_width(2*SPACE_X_RADIUS - 1) everyone.next_to(DOWN, DOWN) background_rect = BackgroundRectangle(everyone) self.play( @@ -1150,7 +1150,7 @@ class NextVideo(Scene): title = TextMobject(""" Next video: Inverse matrices, column space and null space """) - title.scale_to_fit_width(2*SPACE_WIDTH - 2) + title.scale_to_fit_width(2*SPACE_X_RADIUS - 2) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = BLUE) rect.scale_to_fit_height(6) diff --git a/old_projects/eola/chapter6.py b/old_projects/eola/chapter6.py index ba1d6bf0..32795ee9 100644 --- a/old_projects/eola/chapter6.py +++ b/old_projects/eola/chapter6.py @@ -187,8 +187,8 @@ class StockPrices(Scene): def construct(self): self.add(TextMobject("Stock prices").to_edge(UP)) - x_axis = Line(ORIGIN, SPACE_WIDTH*RIGHT) - y_axis = Line(ORIGIN, SPACE_HEIGHT*UP) + x_axis = Line(ORIGIN, SPACE_X_RADIUS*RIGHT) + y_axis = Line(ORIGIN, SPACE_Y_RADIUS*UP) everyone = VMobject(x_axis, y_axis) stock_lines = [] for color in TEAL, PINK, YELLOW, RED, BLUE: @@ -673,7 +673,7 @@ class ShowBijectivity(LinearTransformationScene): Vector([x, y]) for x, y in it.product(*[ np.arange(-int(val)+0.5, int(val)+0.5) - for val in SPACE_WIDTH, SPACE_HEIGHT + for val in SPACE_X_RADIUS, SPACE_Y_RADIUS ]) ]) vectors.submobject_gradient_highlight(BLUE_E, PINK) @@ -833,8 +833,8 @@ class DescribeInverse(LinearTransformationScene): label_mob.add_background_rectangle() m.add(brace, label_mob) text.add(m) - if text.get_width() > 2*SPACE_WIDTH-1: - text.scale_to_fit_width(2*SPACE_WIDTH-1) + if text.get_width() > 2*SPACE_X_RADIUS-1: + text.scale_to_fit_width(2*SPACE_X_RADIUS-1) text.center().to_corner(UP+RIGHT) matrix.highlight(PINK) inv_matrix.highlight(YELLOW) @@ -1530,8 +1530,8 @@ class NameColumnSpace(Scene): class IHatShear(LinearTransformationScene): CONFIG = { "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -1631,8 +1631,8 @@ class OriginIsAlwaysInColumnSpace(LinearTransformationScene): class FullRankCase(LinearTransformationScene): CONFIG = { "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, } @@ -2024,7 +2024,7 @@ class NextVideo(Scene): title = TextMobject(""" Next video: Nonsquare matrices """) - title.scale_to_fit_width(2*SPACE_WIDTH - 2) + title.scale_to_fit_width(2*SPACE_X_RADIUS - 2) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = BLUE) rect.scale_to_fit_height(6) diff --git a/old_projects/eola/chapter7.py b/old_projects/eola/chapter7.py index 65793e7d..86a641df 100644 --- a/old_projects/eola/chapter7.py +++ b/old_projects/eola/chapter7.py @@ -55,7 +55,7 @@ class OpeningQuote(Scene): "No one can say how it happens. " "You either believe it or you don't.", ) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(UP) words[0].highlight(YELLOW) words[2].highlight("#fd9c2b") @@ -105,7 +105,7 @@ class ThisSeriesOrdering(RandolphScene): self.randy.rotate(np.pi, UP) title.scale(1.2).highlight(BLUE) title.to_corner(UP+LEFT) - line = Line(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT, color = WHITE) + line = Line(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT, color = WHITE) line.next_to(title, DOWN, buff = SMALL_BUFF) line.to_edge(LEFT, buff = 0) @@ -128,7 +128,7 @@ class ThisSeriesOrdering(RandolphScene): chapters.arrange_submobjects( DOWN, buff = SMALL_BUFF, aligned_edge = LEFT ) - chapters.scale_to_fit_height(1.5*SPACE_HEIGHT) + chapters.scale_to_fit_height(1.5*SPACE_Y_RADIUS) chapters.next_to(line, DOWN, buff = SMALL_BUFF) chapters.to_edge(RIGHT) @@ -316,7 +316,7 @@ class GeometricInterpretation(VectorScene): self.proj_vect = self.w if self.project_onto_v else self.v def line(self): - line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) line.rotate(self.stable_vect.get_angle()) self.play(ShowCreation(line), Animation(self.stable_vect)) self.wait() @@ -473,7 +473,7 @@ class ShowQualitativeDotProductValues(VectorScene): ) shadow_opposite = shadow.copy().scale(-1) line = Line(LEFT, RIGHT, color = WHITE) - line.scale(SPACE_WIDTH) + line.scale(SPACE_X_RADIUS) line.rotate(v.get_angle()) proj_line = Line(w.get_end(), shadow.get_end(), color = GREY) @@ -551,7 +551,7 @@ class SymmetricVAndW(VectorScene): v1.proj_line = Line( v1.get_end(), v1.proj.get_end(), color = GREY ) - line_of_symmetry = DashedLine(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + line_of_symmetry = DashedLine(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) line_of_symmetry.rotate(np.mean([v.get_angle(), w.get_angle()])) line_of_symmetry_words = TextMobject("Line of symmetry") line_of_symmetry_words.add_background_rectangle() @@ -700,8 +700,8 @@ class TwoDToOneDScene(LinearTransformationScene): CONFIG = { "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : SPACE_WIDTH, - "y_radius" : SPACE_HEIGHT, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, "t_matrix" : [[2, 0], [1, 0]] @@ -797,7 +797,7 @@ class OkayToIgnoreFormalProperties(Scene): def construct(self): title = TextMobject("Formal linearity properties") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) v_tex, w_tex = ["\\vec{\\textbf{%s}}"%s for s in "v", "w"] additivity = TexMobject( @@ -841,14 +841,14 @@ class FormalVsVisual(Scene): title = TextMobject("Linearity") title.highlight(BLUE) title.to_edge(UP) - line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) line.next_to(title, DOWN) - v_line = Line(line.get_center(), SPACE_HEIGHT*DOWN) + v_line = Line(line.get_center(), SPACE_Y_RADIUS*DOWN) formal = TextMobject("Formal definition") visual = TextMobject("Visual intuition") - formal.next_to(line, DOWN).shift(SPACE_WIDTH*LEFT/2) - visual.next_to(line, DOWN).shift(SPACE_WIDTH*RIGHT/2) + formal.next_to(line, DOWN).shift(SPACE_X_RADIUS*LEFT/2) + visual.next_to(line, DOWN).shift(SPACE_X_RADIUS*RIGHT/2) v_tex, w_tex = ["\\vec{\\textbf{%s}}"%c for c in "v", "w"] additivity = TexMobject( @@ -1358,14 +1358,14 @@ class SomeKindOfConnection(Scene): "v_coords" : [2, 3] } def construct(self): - width = SPACE_WIDTH-1 + width = SPACE_X_RADIUS-1 plane = NumberPlane(x_radius = 4, y_radius = 6) squish_plane = plane.copy() i_hat = Vector([1, 0], color = X_COLOR) j_hat = Vector([0, 1], color = Y_COLOR) vect = Vector(self.v_coords, color = YELLOW) plane.add(vect, i_hat, j_hat) - plane.scale_to_fit_width(SPACE_WIDTH) + plane.scale_to_fit_width(SPACE_X_RADIUS) plane.to_edge(LEFT, buff = 0) plane.remove(vect, i_hat, j_hat) @@ -1374,7 +1374,7 @@ class SomeKindOfConnection(Scene): ) squish_plane.add(Vector(self.v_coords[1]*RIGHT, color = Y_COLOR)) squish_plane.add(Vector(self.v_coords[0]*RIGHT, color = X_COLOR)) - squish_plane.scale(width/(2*SPACE_WIDTH)) + squish_plane.scale(width/(2*SPACE_X_RADIUS)) plane.add(j_hat, i_hat) number_line = NumberLine().stretch_to_fit_width(width) @@ -1382,7 +1382,7 @@ class SomeKindOfConnection(Scene): squish_plane.move_to(number_line) numbers = number_line.get_numbers(*range(-6, 8, 2)) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.highlight(GREY) v_line.set_stroke(width = 10) @@ -1514,8 +1514,8 @@ class ProjectOntoUnitVectorNumberline(VectorScene): def get_vectors(self, num_vectors = 10, randomize = True): - x_max = SPACE_WIDTH - 1 - y_max = SPACE_HEIGHT - 1 + x_max = SPACE_X_RADIUS - 1 + y_max = SPACE_Y_RADIUS - 1 x_vals = np.linspace(-x_max, x_max, num_vectors) y_vals = np.linspace(y_max, -y_max, num_vectors) if randomize: @@ -1743,7 +1743,7 @@ class ProjectBasisVectors(ProjectOntoUnitVectorNumberline): def show_symmetry(self, vect, coord, coord_landing_spot): starting_mobjects = list(self.get_mobjects()) - line = DashedLine(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + line = DashedLine(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) words = TextMobject("Line of symmetry") words.next_to(ORIGIN, UP+LEFT) words.shift(LEFT) @@ -2046,14 +2046,14 @@ class TwoDOneDTransformationSeparateSpace(Scene): "v_coords" : [4, 1] } def construct(self): - width = SPACE_WIDTH-1 + width = SPACE_X_RADIUS-1 plane = NumberPlane(x_radius = 6, y_radius = 7) squish_plane = plane.copy() i_hat = Vector([1, 0], color = X_COLOR) j_hat = Vector([0, 1], color = Y_COLOR) vect = Vector(self.v_coords, color = YELLOW) plane.add(vect, i_hat, j_hat) - plane.scale_to_fit_width(SPACE_WIDTH) + plane.scale_to_fit_width(SPACE_X_RADIUS) plane.to_edge(LEFT, buff = 0) plane.remove(vect, i_hat, j_hat) @@ -2062,7 +2062,7 @@ class TwoDOneDTransformationSeparateSpace(Scene): ) squish_plane.add(Vector(self.v_coords[0]*RIGHT, color = X_COLOR)) squish_plane.add(Vector(self.v_coords[1]*RIGHT, color = Y_COLOR)) - squish_plane.scale(width/(2*SPACE_WIDTH)) + squish_plane.scale(width/(2*SPACE_X_RADIUS)) plane.add(i_hat, j_hat) number_line = NumberLine().stretch_to_fit_width(width) @@ -2070,7 +2070,7 @@ class TwoDOneDTransformationSeparateSpace(Scene): squish_plane.move_to(number_line) numbers = number_line.get_numbers(*range(-6, 8, 2)) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.highlight(GREY) v_line.set_stroke(width = 10) @@ -2234,14 +2234,14 @@ class WhatTheVectorWantsToBe(Scene): "v_coords" : [2, 4] } def construct(self): - width = SPACE_WIDTH-1 + width = SPACE_X_RADIUS-1 plane = NumberPlane(x_radius = 6, y_radius = 7) squish_plane = plane.copy() i_hat = Vector([1, 0], color = X_COLOR) j_hat = Vector([0, 1], color = Y_COLOR) vect = Vector(self.v_coords, color = YELLOW) plane.add(vect, i_hat, j_hat) - plane.scale_to_fit_width(SPACE_WIDTH) + plane.scale_to_fit_width(SPACE_X_RADIUS) plane.to_edge(LEFT, buff = 0) plane.remove(vect, i_hat, j_hat) @@ -2250,7 +2250,7 @@ class WhatTheVectorWantsToBe(Scene): ) squish_plane.add(Vector(self.v_coords[1]*RIGHT, color = Y_COLOR)) squish_plane.add(Vector(self.v_coords[0]*RIGHT, color = X_COLOR)) - squish_plane.scale(width/(2*SPACE_WIDTH)) + squish_plane.scale(width/(2*SPACE_X_RADIUS)) plane.add(j_hat, i_hat) number_line = NumberLine().stretch_to_fit_width(width) @@ -2258,7 +2258,7 @@ class WhatTheVectorWantsToBe(Scene): squish_plane.move_to(number_line) numbers = number_line.get_numbers(*range(-6, 8, 2)) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_line.highlight(GREY) v_line.set_stroke(width = 10) diff --git a/old_projects/eola/chapter8.py b/old_projects/eola/chapter8.py index fbd050e4..34ec7562 100644 --- a/old_projects/eola/chapter8.py +++ b/old_projects/eola/chapter8.py @@ -82,7 +82,7 @@ class ListSteps(Scene): def construct(self): title = TextMobject("Two part chapter") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) randy = Randolph().flip().to_corner(DOWN+RIGHT) randy.look(UP+LEFT) @@ -445,19 +445,19 @@ class ContrastDotAndCross(Scene): def add_t_chart(self): for word, vect, color in ("Dot", LEFT, BLUE_C), ("Cross", RIGHT, YELLOW): title = TextMobject("%s product"%word) - title.shift(vect*SPACE_WIDTH/2) + title.shift(vect*SPACE_X_RADIUS/2) title.to_edge(UP) title.highlight(color) self.add(title) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) - l_h_line = Line(LEFT, ORIGIN).scale(SPACE_WIDTH) - r_h_line = Line(ORIGIN, RIGHT).scale(SPACE_WIDTH) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) + l_h_line = Line(LEFT, ORIGIN).scale(SPACE_X_RADIUS) + r_h_line = Line(ORIGIN, RIGHT).scale(SPACE_X_RADIUS) r_h_line.next_to(title, DOWN) l_h_line.next_to(r_h_line, LEFT, buff = 0) self.add(v_line, l_h_line, r_h_line) self.l_h_line, self.r_h_line = l_h_line, r_h_line - def add_dot_products(self, max_width = SPACE_WIDTH-1, dims = [2, 5]): + def add_dot_products(self, max_width = SPACE_X_RADIUS-1, dims = [2, 5]): colors = [X_COLOR, Y_COLOR, Z_COLOR, MAROON_B, TEAL] last_mob = self.l_h_line dot_products = [] @@ -593,7 +593,7 @@ class ContrastDotAndCross(Scene): self.only_3d_text = brace_text def add_2d_cross_product(self): - h_line = DashedLine(ORIGIN, SPACE_WIDTH*RIGHT) + h_line = DashedLine(ORIGIN, SPACE_X_RADIUS*RIGHT) h_line.next_to(self.only_3d_text, DOWN, buff = MED_SMALL_BUFF/2) h_line.to_edge(RIGHT, buff = 0) arrays = np.random.randint(0, 9, (2, 2)) @@ -653,7 +653,7 @@ class PrereqDeterminant(Scene): title = TextMobject(""" Prerequisite: Understanding determinants """) - title.scale_to_fit_width(2*SPACE_WIDTH - 2) + title.scale_to_fit_width(2*SPACE_X_RADIUS - 2) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = BLUE) rect.scale_to_fit_height(6) @@ -970,7 +970,7 @@ class Define2dCrossProduct(LinearTransformationScene): anticommute = TexMobject( v_tex, "\\times", w_tex, "=-", w_tex, "\\times", v_tex ) - anticommute.shift(SPACE_WIDTH*RIGHT/2) + anticommute.shift(SPACE_X_RADIUS*RIGHT/2) anticommute.to_edge(UP) anticommute.highlight_by_tex(v_tex, V_COLOR) anticommute.highlight_by_tex(w_tex, W_COLOR) @@ -1326,14 +1326,14 @@ class WriteCrossProductProperties(Scene): "(parallelogram's area)" ) length_words.highlight_by_tex(p_cash, P_COLOR) - length_words.scale_to_fit_width(SPACE_WIDTH - 1) + length_words.scale_to_fit_width(SPACE_X_RADIUS - 1) length_words.highlight_by_tex("(parallelogram's area)", BLUE) length_words.next_to(VGroup(cross_product, vector), DOWN, buff = LARGE_BUFF) perpendicular = TextMobject( "\\centering Perpendicular to", v_cash, "and", w_cash ) - perpendicular.scale_to_fit_width(SPACE_WIDTH - 1) + perpendicular.scale_to_fit_width(SPACE_X_RADIUS - 1) perpendicular.highlight_by_tex(v_cash, V_COLOR) perpendicular.highlight_by_tex(w_cash, W_COLOR) perpendicular.next_to(length_words, DOWN, buff = LARGE_BUFF) diff --git a/old_projects/eola/chapter8p2.py b/old_projects/eola/chapter8p2.py index 03a01d05..8b6b99b9 100644 --- a/old_projects/eola/chapter8p2.py +++ b/old_projects/eola/chapter8p2.py @@ -38,7 +38,7 @@ class OpeningQuote(Scene): ) words.highlight_by_tex("difficulty of a proof:", RED) words.highlight_by_tex("paint a landscape", GREEN) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) author = TextMobject("-Pierre Deligne") author.highlight(YELLOW) @@ -103,13 +103,13 @@ class BruteForceVerification(Scene): verify computationally """) computation_words.scale(0.75) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) computation_words.to_edge(UP, buff = MED_SMALL_BUFF/2) h_line.next_to(computation_words, DOWN) formula_word.next_to(h_line, UP, buff = MED_SMALL_BUFF) - computation_words.shift(SPACE_WIDTH*RIGHT/2) - formula_word.shift(SPACE_WIDTH*LEFT/2) + computation_words.shift(SPACE_X_RADIUS*RIGHT/2) + formula_word.shift(SPACE_X_RADIUS*LEFT/2) cross_product.next_to(formula_word, DOWN, buff = LARGE_BUFF) @@ -141,8 +141,8 @@ class BruteForceVerification(Scene): "(||", w_tex, "||)", "\\sin(", "\\theta", ")" ) - last_point = h_line.get_center()+SPACE_WIDTH*RIGHT/2 - max_width = SPACE_WIDTH-1 + last_point = h_line.get_center()+SPACE_X_RADIUS*RIGHT/2 + max_width = SPACE_X_RADIUS-1 for mob in v_dot, w_dot, theta_def, length_check: mob.highlight_by_tex(v_tex, V_COLOR) mob.highlight_by_tex(w_tex, W_COLOR) @@ -167,7 +167,7 @@ class Prerequisites(Scene): title.highlight(YELLOW) rect = Rectangle(width = 16, height = 9, color = BLUE) - rect.scale_to_fit_width(SPACE_WIDTH - 1) + rect.scale_to_fit_width(SPACE_X_RADIUS - 1) left_rect, right_rect = [ rect.copy().shift(DOWN/2).to_edge(edge) for edge in LEFT, RIGHT @@ -308,7 +308,7 @@ class ThreeStepPlan(Scene): title = TextMobject("The plan") title.highlight(YELLOW) title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) v_tex, w_tex = get_vect_tex(*"vw") @@ -395,7 +395,7 @@ class DefineDualTransform(Scene): title = TextMobject("What a student might think") title.not_real = TextMobject("Not the real cross product") for mob in title, title.not_real: - mob.scale_to_fit_width(SPACE_WIDTH - 1) + mob.scale_to_fit_width(SPACE_X_RADIUS - 1) mob.highlight(RED) mob.to_edge(UP) self.add(title) @@ -446,7 +446,7 @@ class DefineDualTransform(Scene): final_mobs.next_to(self.title, DOWN, buff = MED_SMALL_BUFF) for mob in definitions, final_mobs: - mob.scale_to_fit_width(SPACE_WIDTH - 1) + mob.scale_to_fit_width(SPACE_X_RADIUS - 1) for array in arrays: brackets = array.get_brackets() @@ -844,7 +844,7 @@ class DotProductWords(Scene): times.next_to(words[0], RIGHT) everyone = VGroup(dot_product, equals, times, words) - everyone.center().scale_to_fit_width(SPACE_WIDTH - 1) + everyone.center().scale_to_fit_width(SPACE_X_RADIUS - 1) self.add(dot_product) self.play(Write(equals)) self.play(Write(words[0])) @@ -876,7 +876,7 @@ class GeometricVolumeWords(Scene): words[1].highlight_by_tex(v_tex, ORANGE) words[1].highlight_by_tex(w_tex, W_COLOR) words.arrange_submobjects(RIGHT) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(DOWN, buff = SMALL_BUFF) for word in words: self.play(Write(word)) @@ -923,8 +923,8 @@ class ChangeOfBasisPreview(LinearTransformationScene): CONFIG = { "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "secondary_line_ratio" : 0 }, "t_matrix" : [[2, 1], [-1, 1]], diff --git a/old_projects/eola/chapter9.py b/old_projects/eola/chapter9.py index 4f655f41..f9b86f30 100644 --- a/old_projects/eola/chapter9.py +++ b/old_projects/eola/chapter9.py @@ -67,7 +67,7 @@ class OpeningQuote(Scene): ) words.highlight_by_tex("same name ", BLUE) words.highlight_by_tex("different things", MAROON_B) - # words.scale_to_fit_width(2*SPACE_WIDTH - 2) + # words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) author = TextMobject("-Henri Poincar\\'e.") author.highlight(YELLOW) @@ -82,8 +82,8 @@ class LinearCombinationScene(LinearTransformationScene): CONFIG = { "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : SPACE_WIDTH, - "y_radius" : SPACE_HEIGHT, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, } @@ -340,8 +340,8 @@ class JenniferScene(LinearCombinationScene): "b1_coords" : [2, 1], "b2_coords" : [-1, 1], "foreground_plane_kwargs" : { - "x_radius" : SPACE_WIDTH, - "y_radius" : SPACE_WIDTH, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : SPACE_X_RADIUS, }, } def setup(self): @@ -1437,7 +1437,7 @@ class Prerequisites(Scene): def construct(self): title = TextMobject("Prerequisites") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title, h_line) @@ -1741,7 +1741,7 @@ class HowToTranslateAMatrix(Scene): def add_title(self): title = TextMobject("How to translate a matrix") title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title) self.play(ShowCreation(h_line)) diff --git a/old_projects/eola/footnote.py b/old_projects/eola/footnote.py index 86306685..3e1ba734 100644 --- a/old_projects/eola/footnote.py +++ b/old_projects/eola/footnote.py @@ -33,7 +33,7 @@ class OpeningQuote(Scene): into...(dramatic pause)...""", "the third dimension." ]) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) words.split()[0].highlight(YELLOW) words.split()[2].highlight(YELLOW) @@ -146,7 +146,7 @@ class PutTogether3x3Matrix(Scene): k_to, k_array, TexMobject("=").highlight(BLACK), ) everything.arrange_submobjects(RIGHT, buff = 0.1) - everything.scale_to_fit_width(2*SPACE_WIDTH-1) + everything.scale_to_fit_width(2*SPACE_X_RADIUS-1) everything.to_edge(DOWN) i_array.highlight(X_COLOR) @@ -238,7 +238,7 @@ class ShowVCoordinateMeaning(Scene): everything = VMobject(v, eq, coords, eq2, lin_comb) everything.arrange_submobjects(buff = 0.2) - everything.scale_to_fit_width(2*SPACE_WIDTH - 1) + everything.scale_to_fit_width(2*SPACE_X_RADIUS - 1) everything.to_edge(DOWN) if not self.post_transform: lin_comb.shift(0.35*UP) @@ -287,7 +287,7 @@ class ShowMatrixVectorMultiplication(Scene): z, col3 ) everything.arrange_submobjects(buff = 0.1) - everything.scale_to_fit_width(2*SPACE_WIDTH-1) + everything.scale_to_fit_width(2*SPACE_X_RADIUS-1) result = VMobject(x, col1, plus1, y, col2, plus2, z, col3) trips = [ @@ -361,7 +361,7 @@ class ShowMatrixMultiplication(Scene): braces.append(brace) right_brace, left_brace = braces - VMobject(*self.get_mobjects()).scale_to_fit_width(2*SPACE_WIDTH-1) + VMobject(*self.get_mobjects()).scale_to_fit_width(2*SPACE_X_RADIUS-1) self.add(right, left) self.play(Write(right_brace)) @@ -423,7 +423,7 @@ class NextVideo(Scene): title = TextMobject(""" Next video: The determinant """) - title.scale_to_fit_width(2*SPACE_WIDTH - 2) + title.scale_to_fit_width(2*SPACE_X_RADIUS - 2) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = BLUE) rect.scale_to_fit_height(6) diff --git a/old_projects/eola/footnote2.py b/old_projects/eola/footnote2.py index c67e5e9e..882895b8 100644 --- a/old_projects/eola/footnote2.py +++ b/old_projects/eola/footnote2.py @@ -30,7 +30,7 @@ class OpeningQuote(Scene): "2x3 matrix.", "Some of you, to my great amusement, actually tried to do this.''" ) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.to_edge(UP) words[1].highlight(GREEN) author = TextMobject("-(Via mathprofessorquotes.com, no name listed)") @@ -355,8 +355,8 @@ class ThreeDToTwoDOutput(LinearTransformationScene): "show_basis_vectors" : False, "foreground_plane_kwargs" : { "color" : GREY, - "x_radius" : SPACE_WIDTH, - "y_radius" : SPACE_HEIGHT, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : SPACE_Y_RADIUS, "secondary_line_ratio" : 0 }, } @@ -441,8 +441,8 @@ class TwoDTo1DTransform(LinearTransformationScene): CONFIG = { "include_background_plane" : False, "foreground_plane_kwargs" : { - "x_radius" : SPACE_WIDTH, - "y_radius" : SPACE_HEIGHT, + "x_radius" : SPACE_X_RADIUS, + "y_radius" : SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, "t_matrix" : [[1, 0], [2, 0]], @@ -534,7 +534,7 @@ class NextVideo(Scene): title = TextMobject(""" Next video: Dot products and duality """) - title.scale_to_fit_width(2*SPACE_WIDTH - 2) + title.scale_to_fit_width(2*SPACE_X_RADIUS - 2) title.to_edge(UP) rect = Rectangle(width = 16, height = 9, color = BLUE) rect.scale_to_fit_height(6) diff --git a/old_projects/eola/thumbnails.py b/old_projects/eola/thumbnails.py index 1fda50fe..c1ec51eb 100644 --- a/old_projects/eola/thumbnails.py +++ b/old_projects/eola/thumbnails.py @@ -50,8 +50,8 @@ class Chapter2(LinearTransformationScene): self.lock_in_faded_grid() vectors = VMobject(*[ Vector([x, y]) - for x in np.arange(-int(SPACE_WIDTH)+0.5, int(SPACE_WIDTH)+0.5) - for y in np.arange(-int(SPACE_HEIGHT)+0.5, int(SPACE_HEIGHT)+0.5) + for x in np.arange(-int(SPACE_X_RADIUS)+0.5, int(SPACE_X_RADIUS)+0.5) + for y in np.arange(-int(SPACE_Y_RADIUS)+0.5, int(SPACE_Y_RADIUS)+0.5) ]) vectors.submobject_gradient_highlight(PINK, BLUE_E) words = TextMobject("Span") @@ -118,8 +118,8 @@ class Chapter9(Scene): class Chapter10(LinearTransformationScene): CONFIG = { "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 1 }, diff --git a/old_projects/eulers_characteristic_formula.py b/old_projects/eulers_characteristic_formula.py index 54cb4c13..72daad24 100644 --- a/old_projects/eulers_characteristic_formula.py +++ b/old_projects/eulers_characteristic_formula.py @@ -600,8 +600,8 @@ class FacebookGraphAsAbstractSet(Scene): friendships = TextMobject("\\textbf{Friendships}") friendships.shift(3*RIGHT).to_edge(UP) lines = Mobject( - Line(UP*SPACE_HEIGHT, DOWN*SPACE_HEIGHT), - Line(LEFT*SPACE_WIDTH + 3*UP, RIGHT*SPACE_WIDTH + 3*UP) + Line(UP*SPACE_Y_RADIUS, DOWN*SPACE_Y_RADIUS), + Line(LEFT*SPACE_X_RADIUS + 3*UP, RIGHT*SPACE_X_RADIUS + 3*UP) ).highlight("white") self.add(accounts, friendships, lines) @@ -626,13 +626,13 @@ class ExamplesOfGraphs(GraphScene): ["Objects \\quad\\quad ", "Thing that connects objects"] )).to_corner().shift(0.5*RIGHT).split() horizontal_line = Line( - (-SPACE_WIDTH, SPACE_HEIGHT-1, 0), - (max(notions.points[:,0]), SPACE_HEIGHT-1, 0) + (-SPACE_X_RADIUS, SPACE_Y_RADIUS-1, 0), + (max(notions.points[:,0]), SPACE_Y_RADIUS-1, 0) ) vert_line_x_val = min(notions.points[:,0]) - buff vertical_line = Line( - (vert_line_x_val, SPACE_HEIGHT, 0), - (vert_line_x_val,-SPACE_HEIGHT, 0) + (vert_line_x_val, SPACE_Y_RADIUS, 0), + (vert_line_x_val,-SPACE_Y_RADIUS, 0) ) objects_and_notions = [ ("Facebook accounts", "Friendship"), @@ -651,7 +651,7 @@ class ExamplesOfGraphs(GraphScene): for (obj, notion), height in zip(objects_and_notions, it.count(2, -1)): obj_mob = TextMobject(obj, size = "\\small").to_edge(LEFT) not_mob = TextMobject(notion, size = "\\small").to_edge(LEFT) - not_mob.shift((vert_line_x_val + SPACE_WIDTH)*RIGHT) + not_mob.shift((vert_line_x_val + SPACE_X_RADIUS)*RIGHT) obj_mob.shift(height*UP) not_mob.shift(height*UP) @@ -773,10 +773,10 @@ class DrawDualGraph(GraphScene): outer_region_mob = region_mobs.pop() outer_dual_vertex = self.dual_vertices.pop() internal_edges = filter( - lambda e : abs(e.start[0]) < SPACE_WIDTH and \ - abs(e.end[0]) < SPACE_WIDTH and \ - abs(e.start[1]) < SPACE_HEIGHT and \ - abs(e.end[1]) < SPACE_HEIGHT, + lambda e : abs(e.start[0]) < SPACE_X_RADIUS and \ + abs(e.end[0]) < SPACE_X_RADIUS and \ + abs(e.start[1]) < SPACE_Y_RADIUS and \ + abs(e.end[1]) < SPACE_Y_RADIUS, self.dual_edges ) external_edges = filter( @@ -794,7 +794,7 @@ class DrawDualGraph(GraphScene): self.wait() self.reset_background() self.play(ApplyFunction( - lambda p : (SPACE_WIDTH + SPACE_HEIGHT)*p/np.linalg.norm(p), + lambda p : (SPACE_X_RADIUS + SPACE_Y_RADIUS)*p/np.linalg.norm(p), outer_region_mob )) self.wait() @@ -849,9 +849,9 @@ class ListOfCorrespondances(Scene): mob.shift(height*UP) arrow_xs = this_arrow.points[:,0] left.to_edge(RIGHT) - left.shift((min(arrow_xs) - SPACE_WIDTH, 0, 0)) + left.shift((min(arrow_xs) - SPACE_X_RADIUS, 0, 0)) right.to_edge(LEFT) - right.shift((max(arrow_xs) + SPACE_WIDTH, 0, 0)) + right.shift((max(arrow_xs) + SPACE_X_RADIUS, 0, 0)) lines.append(Mobject(left, right, this_arrow)) last = None for line in lines: diff --git a/old_projects/fourier.py b/old_projects/fourier.py index 3f9523ae..27a72c4a 100644 --- a/old_projects/fourier.py +++ b/old_projects/fourier.py @@ -348,7 +348,7 @@ class AddingPureFrequencies(PiCreatureScene): self.play(*it.chain( map(MoveToTarget, movers), [ - ApplyMethod(mob.shift, SPACE_HEIGHT*DOWN, remover = True) + ApplyMethod(mob.shift, SPACE_Y_RADIUS*DOWN, remover = True) for mob in randy, speaker ] )) @@ -374,7 +374,7 @@ class AddingPureFrequencies(PiCreatureScene): top_axes_point = axes.coords_to_point(x, self.equilibrium_height) x_point = np.array(top_axes_point) x_point[1] = 0 - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT).move_to(x_point) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS).move_to(x_point) self.revert_to_original_skipping_status() self.play(GrowFromCenter(v_line)) @@ -415,7 +415,7 @@ class AddingPureFrequencies(PiCreatureScene): D_axes = self.D_axes rect = Rectangle( - height = 2.5*SPACE_HEIGHT, + height = 2.5*SPACE_Y_RADIUS, width = MED_SMALL_BUFF, stroke_width = 0, fill_color = YELLOW, @@ -606,7 +606,7 @@ class BreakApartSum(Scene): "unit_size" : 0.5, }, ) - axes.stretch_to_fit_width(2*SPACE_WIDTH - 2) + axes.stretch_to_fit_width(2*SPACE_X_RADIUS - 2) axes.stretch_to_fit_height(3) axes.center() axes.to_edge(LEFT) @@ -2266,7 +2266,7 @@ class BeforeGettingToTheFullMath(TeacherStudentsScene): self.wait() self.play( ApplyMethod( - formula.next_to, SPACE_WIDTH*RIGHT, RIGHT, + formula.next_to, SPACE_X_RADIUS*RIGHT, RIGHT, path_arc = TAU/16, rate_func = running_start, ), @@ -2402,7 +2402,7 @@ class FilterOutHighPitch(AddingPureFrequencies, ShowCommutativeDiagram): ReplacementTransform(time_axes.labels[0].copy(), freq_label), GrowArrow(arrow), Write(ft_words), - VGroup(randy, speaker).shift, SPACE_HEIGHT*DOWN, + VGroup(randy, speaker).shift, SPACE_Y_RADIUS*DOWN, ) self.remove(randy, speaker) self.wait() @@ -2562,7 +2562,7 @@ class ApplyFourierToFourier(DrawFrequencyPlot): ), ) self.play( - wound_up_graph.next_to, SPACE_WIDTH*LEFT, LEFT, + wound_up_graph.next_to, SPACE_X_RADIUS*LEFT, LEFT, remover = True ) self.wait() @@ -2611,8 +2611,8 @@ class WriteComplexExponentialExpression(DrawFrequencyPlot): "initial_winding_frequency" : 0.1, "circle_plane_config" : { "unit_size" : 2, - "y_radius" : SPACE_HEIGHT+LARGE_BUFF, - "x_radius" : SPACE_WIDTH+LARGE_BUFF + "y_radius" : SPACE_Y_RADIUS+LARGE_BUFF, + "x_radius" : SPACE_X_RADIUS+LARGE_BUFF } } def construct(self): @@ -3861,7 +3861,7 @@ class BoundsAtInfinity(SummarizeFormula): graph = self.graph time_interval = self.get_time_interval(-2, 2) - wide_interval = self.get_time_interval(-SPACE_WIDTH, SPACE_WIDTH) + wide_interval = self.get_time_interval(-SPACE_X_RADIUS, SPACE_X_RADIUS) bounds = VGroup(*reversed(expression.get_parts_by_tex("t_"))) bound_rects = VGroup(*[ SurroundingRectangle(b, buff = 0.5*SMALL_BUFF) @@ -3988,8 +3988,8 @@ class ShowUncertaintyPrinciple(Scene): title = TextMobject("Uncertainty principle") self.add(title) top_axes = Axes( - x_min = -SPACE_WIDTH, - x_max = SPACE_WIDTH, + x_min = -SPACE_X_RADIUS, + x_max = SPACE_X_RADIUS, y_min = 0, y_max = 3, y_axis_config = { @@ -4295,7 +4295,7 @@ class Thumbnail(Scene): self.clear() title.center().to_edge(UP) - pol_graphs.scale_to_fit_width(2*SPACE_WIDTH - 1) + pol_graphs.scale_to_fit_width(2*SPACE_X_RADIUS - 1) pol_graphs.center() title.move_to(pol_graphs) title.shift(SMALL_BUFF*LEFT) diff --git a/old_projects/fractal_dimension.py b/old_projects/fractal_dimension.py index f1a24641..4a7e8a24 100644 --- a/old_projects/fractal_dimension.py +++ b/old_projects/fractal_dimension.py @@ -327,8 +327,8 @@ class SelfSimilarFractalsAsSubset(Scene): def add_general_fractals(self): big_rectangle = Rectangle( - width = 2*SPACE_WIDTH - MED_LARGE_BUFF, - height = 2*SPACE_HEIGHT - MED_LARGE_BUFF, + width = 2*SPACE_X_RADIUS - MED_LARGE_BUFF, + height = 2*SPACE_Y_RADIUS - MED_LARGE_BUFF, ) title = TextMobject("Fractals") title.scale(1.5) @@ -371,15 +371,15 @@ class ConstrastSmoothAndFractal(Scene): "fractal_dimension" : 1.21, } def construct(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) smooth = TextMobject("Smooth") - smooth.shift(SPACE_WIDTH*LEFT/2) + smooth.shift(SPACE_X_RADIUS*LEFT/2) fractal = TextMobject("Fractal") - fractal.shift(SPACE_WIDTH*RIGHT/2) + fractal.shift(SPACE_X_RADIUS*RIGHT/2) VGroup(smooth, fractal).to_edge(UP) background_rectangle = Rectangle( - height = 2*SPACE_HEIGHT, - width = SPACE_WIDTH, + height = 2*SPACE_Y_RADIUS, + width = SPACE_X_RADIUS, ) background_rectangle.to_edge(RIGHT, buff = 0) background_rectangle.set_fill(BLACK, 1) @@ -394,13 +394,13 @@ class ConstrastSmoothAndFractal(Scene): anchors = britain.get_anchors() smooth_britain = VMobject() smooth_britain.set_points_smoothly(anchors[::10]) - smooth_britain.center().shift(SPACE_WIDTH*LEFT/2) + smooth_britain.center().shift(SPACE_X_RADIUS*LEFT/2) index = np.argmax(smooth_britain.get_anchors()[:,0]) smooth_britain.zoom_point = smooth_britain.point_from_proportion( self.britain_zoom_point_proportion ) - britain.shift(SPACE_WIDTH*RIGHT/2) + britain.shift(SPACE_X_RADIUS*RIGHT/2) britain.zoom_point = britain.point_from_proportion( self.britain_zoom_point_proportion ) @@ -468,7 +468,7 @@ class InfiniteKochZoom(Scene): class ShowIdealizations(Scene): def construct(self): - arrow = DoubleArrow(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + arrow = DoubleArrow(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) arrow.shift(DOWN) left_words = TextMobject("Idealization \\\\ as smooth") middle_words = TextMobject("Nature") @@ -635,7 +635,7 @@ class FourSelfSimilarShapes(Scene): "Line", "Square", "Cube", "Sierpinski" ])) for title, x in zip(titles, np.linspace(-0.75, 0.75, 4)): - title.shift(x*SPACE_WIDTH*RIGHT) + title.shift(x*SPACE_X_RADIUS*RIGHT) titles.to_edge(UP) return titles @@ -857,7 +857,7 @@ class ScaledLineMass(Scene): shape = self.get_shape() shape.scale_to_fit_width(self.shape_width) shape.center() - shape.shift(SPACE_WIDTH*RIGHT/2 + self.vert_distance*UP) + shape.shift(SPACE_X_RADIUS*RIGHT/2 + self.vert_distance*UP) big_brace = Brace(shape, self.brace_direction) big_brace_text = big_brace.get_text("$1$") @@ -979,14 +979,14 @@ class DefineTwoDimensional(PiCreatureScene): self.title = title def add_h_line(self): - self.h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + self.h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) self.add(self.h_line) def add_shape(self): shape = self.get_shape() shape.scale_to_fit_width(self.shape_width) shape.next_to(self.title, DOWN, buff = MED_LARGE_BUFF) - # self.shape.shift(SPACE_HEIGHT*UP/2) + # self.shape.shift(SPACE_Y_RADIUS*UP/2) self.mass_color = shape.get_color() self.add(shape) @@ -1207,10 +1207,10 @@ class LengthAndAreaOfSierpinski(ShowSierpinskiCurve): } def construct(self): length = TextMobject("Length = $\\infty$") - length.shift(SPACE_WIDTH*LEFT/2).to_edge(UP) + length.shift(SPACE_X_RADIUS*LEFT/2).to_edge(UP) area = TextMobject("Area = $0$") - area.shift(SPACE_WIDTH*RIGHT/2).to_edge(UP) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + area.shift(SPACE_X_RADIUS*RIGHT/2).to_edge(UP) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) self.add(length, area, v_line) curve = self.get_curve(order = self.curve_start_order) @@ -1239,12 +1239,12 @@ class LengthAndAreaOfSierpinski(ShowSierpinskiCurve): # curve = ShowSierpinskiCurve.get_curve(self, order) curve = SierpinskiCurve(order = order) curve.scale_to_fit_height(4).center() - curve.shift(SPACE_WIDTH*LEFT/2) + curve.shift(SPACE_X_RADIUS*LEFT/2) return curve def get_sierpinski(self, order): result = Sierpinski(order = order) - result.shift(SPACE_WIDTH*RIGHT/2) + result.shift(SPACE_X_RADIUS*RIGHT/2) return result class FractionalAnalogOfLengthAndArea(Scene): @@ -1450,14 +1450,14 @@ class DimensionOfQuadraticKoch(DimensionOfKoch): def add_curve(self): seed_label = TextMobject("Seed") - seed_label.shift(SPACE_WIDTH*RIGHT/2).to_edge(UP) + seed_label.shift(SPACE_X_RADIUS*RIGHT/2).to_edge(UP) seed = self.get_curve(order = 1) seed.next_to(seed_label, DOWN) curve = seed.copy() resulting_fractal = TextMobject("Resulting fractal") - resulting_fractal.shift(SPACE_WIDTH*RIGHT/2) + resulting_fractal.shift(SPACE_X_RADIUS*RIGHT/2) self.add(seed_label, seed) self.wait() @@ -1731,17 +1731,17 @@ class BoxCountingScene(Scene): "corner_rect_left_extension" : 0, } def setup(self): - self.num_rows = 2*int(SPACE_HEIGHT/self.box_width)+1 - self.num_cols = 2*int(SPACE_WIDTH/self.box_width)+1 + self.num_rows = 2*int(SPACE_Y_RADIUS/self.box_width)+1 + self.num_cols = 2*int(SPACE_X_RADIUS/self.box_width)+1 def get_grid(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) v_lines = VGroup(*[ v_line.copy().shift(u*x*self.box_width*RIGHT) for x in range(self.num_cols/2+1) for u in [-1, 1] ]) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_lines = VGroup(*[ h_line.copy().shift(u*y*self.box_width*UP) for y in range(self.num_rows/2+1) @@ -1811,8 +1811,8 @@ class BoxCountingScene(Scene): def get_corner_rect(self): rect = Rectangle( - height = SPACE_HEIGHT/2, - width = SPACE_WIDTH+self.corner_rect_left_extension, + height = SPACE_Y_RADIUS/2, + width = SPACE_X_RADIUS+self.corner_rect_left_extension, stroke_width = 0, fill_color = BLACK, fill_opacity = 0.8 @@ -2736,14 +2736,14 @@ class CompareBritainAndNorway(Scene): norway.to_corner(UP+RIGHT, buff = 0) fractalify(norway, order = 1, dimension = 1.5) anchors = list(norway.get_anchors()) - anchors.append(SPACE_WIDTH*RIGHT+SPACE_HEIGHT*UP) + anchors.append(SPACE_X_RADIUS*RIGHT+SPACE_Y_RADIUS*UP) norway.set_points_as_corners(anchors) britain = Britain( fill_opacity = 0, stroke_width = 2 ) - britain.shift(SPACE_WIDTH*LEFT/2) + britain.shift(SPACE_X_RADIUS*LEFT/2) britain.to_edge(UP) fractalify(britain, order = 1, dimension = 1.21) @@ -2779,8 +2779,8 @@ class CompareOceansLabels(Scene): label1 = TextMobject("Dimension $\\approx 2.05$") label2 = TextMobject("Dimension $\\approx 2.3$") - label1.shift(SPACE_WIDTH*LEFT/2).to_edge(UP) - label2.shift(SPACE_WIDTH*RIGHT/2).to_edge(UP) + label1.shift(SPACE_X_RADIUS*LEFT/2).to_edge(UP) + label2.shift(SPACE_X_RADIUS*RIGHT/2).to_edge(UP) self.play(Write(label1)) self.wait() @@ -2798,8 +2798,8 @@ class FractalNonFractalFlowChart(Scene): man_made = TextMobject("Probably \\\\ man-made") is_fractal.to_edge(UP) - nature.shift(SPACE_WIDTH*LEFT/2) - man_made.shift(SPACE_WIDTH*RIGHT/2) + nature.shift(SPACE_X_RADIUS*LEFT/2) + man_made.shift(SPACE_X_RADIUS*RIGHT/2) yes_arrow = Arrow( is_fractal.get_bottom(), @@ -2953,7 +2953,7 @@ class Thumbnail(Scene): koch_curve = QuadraticKoch(order = 6, monochromatic = True) koch_curve.set_stroke(width = 0) koch_curve.set_fill(BLUE) - koch_curve.scale_to_fit_height(1.5*SPACE_HEIGHT) + koch_curve.scale_to_fit_height(1.5*SPACE_Y_RADIUS) koch_curve.to_edge(DOWN, buff = SMALL_BUFF) self.add(koch_curve, title) diff --git a/old_projects/hanoi.py b/old_projects/hanoi.py index 236ddcfb..8d5b3506 100644 --- a/old_projects/hanoi.py +++ b/old_projects/hanoi.py @@ -30,7 +30,7 @@ class CountingScene(Scene): CONFIG = { "base" : 10, "power_colors" : [YELLOW, MAROON_B, RED, GREEN, BLUE, PURPLE_D], - "counting_dot_starting_position" : (SPACE_WIDTH-1)*RIGHT + (SPACE_HEIGHT-1)*UP, + "counting_dot_starting_position" : (SPACE_X_RADIUS-1)*RIGHT + (SPACE_Y_RADIUS-1)*UP, "count_dot_starting_radius" : 0.5, "dot_configuration_height" : 2, "ones_configuration_location" : UP+2*RIGHT, @@ -534,7 +534,7 @@ class IntroduceKeith(Scene): keith = Keith(mode = "dance_kick") keith_image = ImageMobject("keith_schwarz", invert = False) # keith_image = Rectangle() - keith_image.scale_to_fit_height(2*SPACE_HEIGHT - 2) + keith_image.scale_to_fit_height(2*SPACE_Y_RADIUS - 2) keith_image.next_to(ORIGIN, LEFT) keith.move_to(keith_image, DOWN+RIGHT) morty.next_to(keith, buff = LARGE_BUFF, aligned_edge = DOWN) @@ -992,7 +992,7 @@ class RhythmOfDecimalCounting(CountingScene): class DecimalCountingAtHundredsScale(CountingScene): CONFIG = { "power_colors" : [RED, GREEN, BLUE, PURPLE_D], - "counting_dot_starting_position" : (SPACE_WIDTH+1)*RIGHT + (SPACE_HEIGHT-2)*UP, + "counting_dot_starting_position" : (SPACE_X_RADIUS+1)*RIGHT + (SPACE_Y_RADIUS-2)*UP, "ones_configuration_location" : 2*UP+5.7*RIGHT, "num_start_location" : DOWN + 3*RIGHT } @@ -1141,8 +1141,8 @@ class IntroduceBinaryCounting(BinaryCountingScene): def show_self_similarity(self): cover_rect = Rectangle() - cover_rect.scale_to_fit_width(2*SPACE_WIDTH) - cover_rect.scale_to_fit_height(2*SPACE_HEIGHT) + cover_rect.scale_to_fit_width(2*SPACE_X_RADIUS) + cover_rect.scale_to_fit_height(2*SPACE_Y_RADIUS) cover_rect.set_stroke(width = 0) cover_rect.set_fill(BLACK, opacity = 0.85) big_dot = self.curr_configurations[-1][0].copy() @@ -1152,7 +1152,7 @@ class IntroduceBinaryCounting(BinaryCountingScene): ) self.play( big_dot.center, - big_dot.scale_to_fit_height, 2*SPACE_HEIGHT-2, + big_dot.scale_to_fit_height, 2*SPACE_Y_RADIUS-2, big_dot.to_edge, LEFT, run_time = 5 ) @@ -2060,7 +2060,7 @@ class RecursiveSolutionToConstrained(RecursiveSolution): ] sub_steps, sub_sub_steps = subdivisions[:2] for steps in subdivisions: - steps.scale_to_fit_width(2*SPACE_WIDTH-1) + steps.scale_to_fit_width(2*SPACE_X_RADIUS-1) subdivisions.append( TextMobject("\\tiny Move disk 0, Move disk 0").highlight(BLUE) ) @@ -2219,7 +2219,7 @@ class RecursiveSolutionToConstrained(RecursiveSolution): smaller_subdivision.set_fill(opacity = 0) self.play( steps.shift, - (SPACE_HEIGHT-sub_sub_steps.get_top()[1]-MED_SMALL_BUFF)*UP, + (SPACE_Y_RADIUS-sub_sub_steps.get_top()[1]-MED_SMALL_BUFF)*UP, self.eyes.look_at_anim(steps) ) self.play(ApplyMethod( @@ -2388,7 +2388,7 @@ class CompareNumberSystems(Scene): class IntroduceTernaryCounting(CountingScene): CONFIG = { "base" : 3, - "counting_dot_starting_position" : (SPACE_WIDTH-1)*RIGHT + (SPACE_HEIGHT-1)*UP, + "counting_dot_starting_position" : (SPACE_X_RADIUS-1)*RIGHT + (SPACE_Y_RADIUS-1)*UP, "count_dot_starting_radius" : 0.5, "dot_configuration_height" : 1, "ones_configuration_location" : UP+2*RIGHT, @@ -2443,7 +2443,7 @@ class TernaryCountingSelfSimilarPattern(Scene): for i, color in enumerate(colors[:-1]): step[-i-2].highlight(color) VGroup(*steps[1::2]).highlight(colors[-1]) - steps.scale_to_fit_width(2*SPACE_WIDTH-1) + steps.scale_to_fit_width(2*SPACE_X_RADIUS-1) brace = Brace(steps, UP) word_group = VGroup(title, brace, steps) word_group.arrange_submobjects(DOWN) @@ -2720,7 +2720,7 @@ class AnswerConfigurationsCount(TowersOfHanoiScene): for d in range(self.num_disks) ])) parentheticals.arrange_submobjects() - parentheticals.scale_to_fit_width(2*SPACE_WIDTH-1) + parentheticals.scale_to_fit_width(2*SPACE_X_RADIUS-1) parentheticals.next_to(top_mob, DOWN) for parens in parentheticals: brace = Brace(parens) @@ -2758,7 +2758,7 @@ class AnswerConfigurationsCount(TowersOfHanoiScene): class ThisIsMostEfficientText(Scene): def construct(self): text = TextMobject("This is the most efficient solution") - text.scale_to_fit_width(2*SPACE_WIDTH - 1) + text.scale_to_fit_width(2*SPACE_X_RADIUS - 1) text.to_edge(DOWN) self.play(Write(text)) self.wait(2) @@ -2882,7 +2882,7 @@ class SierpinskiGraphScene(Scene): self.nodes.add(node) if self.include_towers: self.add_towers_to_nodes() - self.nodes.scale_to_fit_height(2*SPACE_HEIGHT-2) + self.nodes.scale_to_fit_height(2*SPACE_Y_RADIUS-2) self.nodes.to_edge(UP) def get_node_circles(self, order = 3): @@ -2967,10 +2967,10 @@ class SierpinskiGraphScene(Scene): for index in node_indices ]) everything = VGroup(*self.get_mobjects()) - if nodes.get_width()/nodes.get_height() > SPACE_WIDTH/SPACE_HEIGHT: - scale_factor = (2*SPACE_WIDTH-2)/nodes.get_width() + if nodes.get_width()/nodes.get_height() > SPACE_X_RADIUS/SPACE_Y_RADIUS: + scale_factor = (2*SPACE_X_RADIUS-2)/nodes.get_width() else: - scale_factor = (2*SPACE_HEIGHT-2)/nodes.get_height() + scale_factor = (2*SPACE_Y_RADIUS-2)/nodes.get_height() self.play( everything.shift, -nodes.get_center(), everything.scale, scale_factor @@ -3003,7 +3003,7 @@ class IntroduceGraphStructure(SierpinskiGraphScene): node = self.nodes[index] node.save_state() self.play( - node.scale_to_fit_height, 2*SPACE_HEIGHT-2, + node.scale_to_fit_height, 2*SPACE_Y_RADIUS-2, node.next_to, ORIGIN, vect ) self.wait() diff --git a/old_projects/highD.py b/old_projects/highD.py index df34c46b..f85a3fb5 100644 --- a/old_projects/highD.py +++ b/old_projects/highD.py @@ -543,20 +543,20 @@ class CirclesSpheresSumsSquares(ExternallyAnimatedScene): class BackAndForth(Scene): def construct(self): analytic = TextMobject("Analytic") - analytic.shift(SPACE_WIDTH*LEFT/2) + analytic.shift(SPACE_X_RADIUS*LEFT/2) analytic.to_edge(UP, buff = MED_SMALL_BUFF) geometric = TextMobject("Geometric") - geometric.shift(SPACE_WIDTH*RIGHT/2) + geometric.shift(SPACE_X_RADIUS*RIGHT/2) geometric.to_edge(UP, buff = MED_SMALL_BUFF) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.to_edge(UP, LARGE_BUFF) - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) self.add(analytic, geometric, h_line, v_line) pair = TexMobject("(", "x", ",", "y", ")") - pair.shift(SPACE_WIDTH*LEFT/2 + SPACE_HEIGHT*UP/3) + pair.shift(SPACE_X_RADIUS*LEFT/2 + SPACE_Y_RADIUS*UP/3) triplet = TexMobject("(", "x", ",", "y", ",", "z", ")") - triplet.shift(SPACE_WIDTH*LEFT/2 + SPACE_HEIGHT*DOWN/2) + triplet.shift(SPACE_X_RADIUS*LEFT/2 + SPACE_Y_RADIUS*DOWN/2) for mob in pair, triplet: arrow = DoubleArrow(LEFT, RIGHT) arrow.move_to(mob) @@ -572,7 +572,7 @@ class BackAndForth(Scene): plane_group = VGroup(plane, circle) plane_group.scale(0.4) plane_group.next_to(h_line, DOWN, SMALL_BUFF) - plane_group.shift(SPACE_WIDTH*RIGHT/2) + plane_group.shift(SPACE_X_RADIUS*RIGHT/2) self.play(Write(pair)) @@ -804,20 +804,20 @@ class OfferAHybrid(SliderScene): def construct(self): self.remove(self.sliders) titles = self.get_titles() - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(titles, DOWN) v_lines = VGroup(*[ - Line(UP, DOWN).scale(SPACE_HEIGHT) + Line(UP, DOWN).scale(SPACE_Y_RADIUS) for x in range(2) ]) v_lines.generate_target() for line, vect in zip(v_lines.target, [LEFT, RIGHT]): - line.shift(vect*SPACE_WIDTH/3) + line.shift(vect*SPACE_X_RADIUS/3) equation = TexMobject("x^2 + y^2 + z^2 = 1") equation.generate_target() - equation.shift(SPACE_WIDTH*LEFT/2) - equation.target.shift(2*SPACE_WIDTH*LEFT/3) + equation.shift(SPACE_X_RADIUS*LEFT/2) + equation.target.shift(2*SPACE_X_RADIUS*LEFT/3) self.add(titles, h_line, v_lines, equation) self.wait() @@ -836,10 +836,10 @@ class OfferAHybrid(SliderScene): titles[1].highlight(BLUE) titles.generate_target() titles[1].scale_in_place(0.001) - titles[0].shift(SPACE_WIDTH*LEFT/2) - titles.target[0].shift(2*SPACE_WIDTH*LEFT/3) - titles[2].shift(SPACE_WIDTH*RIGHT/2) - titles.target[2].shift(2*SPACE_WIDTH*RIGHT/3) + titles[0].shift(SPACE_X_RADIUS*LEFT/2) + titles.target[0].shift(2*SPACE_X_RADIUS*LEFT/3) + titles[2].shift(SPACE_X_RADIUS*RIGHT/2) + titles.target[2].shift(2*SPACE_X_RADIUS*RIGHT/3) return titles class TODOBoxExample(TODOStub): @@ -1766,7 +1766,7 @@ class ThreeDCubeCorners(Scene): name = TextMobject("Corners: ") name.next_to(coordinates[0], LEFT) group = VGroup(name, coordinates) - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) group.to_edge(LEFT) self.play(Write(name, run_time = 2)) @@ -2480,7 +2480,7 @@ class FourDBoxExampleWithSliders(ThreeDBoxExampleWithSliders): title = TextMobject( "$2 \\!\\times\\! 2 \\!\\times\\! 2 \\!\\times\\! 2$ box vertices:" ) - title.shift(SPACE_WIDTH*LEFT/2) + title.shift(SPACE_X_RADIUS*LEFT/2) title.to_edge(UP) coordinates = list(it.product(*4*[[1, -1]])) @@ -3110,7 +3110,7 @@ class ThreeDOuterBoundingBoxWords(Scene): "$4 \\!\\times\\! 4\\!\\times\\! 4$ outer\\\\", "bounding box" ) - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) words.to_edge(DOWN) words.highlight(MAROON_B) @@ -3544,7 +3544,7 @@ class Podcast(TeacherStudentsScene): title = TextMobject("Podcast!") title.scale(1.5) title.to_edge(UP) - title.shift(SPACE_WIDTH*LEFT/2) + title.shift(SPACE_X_RADIUS*LEFT/2) self.add(title) q_and_a = TextMobject("Q\\&A Followup") diff --git a/old_projects/hilbert/section2.py b/old_projects/hilbert/section2.py index c94c6588..ea42efe2 100644 --- a/old_projects/hilbert/section2.py +++ b/old_projects/hilbert/section2.py @@ -40,7 +40,7 @@ from helpers import * def get_time_line(): - length = 5.2*SPACE_WIDTH + length = 5.2*SPACE_X_RADIUS year_range = 400 time_line = NumberLine( numerical_radius = year_range/2, @@ -123,8 +123,8 @@ class AskMathematicianFriend(Scene): class TimeLineAboutSpaceFilling(Scene): def construct(self): curve = PeanoCurve(order = 5) - curve.stretch_to_fit_width(2*SPACE_WIDTH) - curve.stretch_to_fit_height(2*SPACE_HEIGHT) + curve.stretch_to_fit_width(2*SPACE_X_RADIUS) + curve.stretch_to_fit_height(2*SPACE_Y_RADIUS) curve_start = curve.copy() curve_start.apply_over_attr_arrays( lambda arr : arr[:200] @@ -525,7 +525,7 @@ class FormalDefinitionOfContinuity(Scene): self.output.highlight(GREEN_A) self.interval = UnitInterval() - self.interval.scale_to_fit_width(SPACE_WIDTH-1) + self.interval.scale_to_fit_width(SPACE_X_RADIUS-1) self.interval.to_edge(LEFT) self.input_dot = Dot(color = self.input_color) @@ -574,12 +574,12 @@ class FormalDefinitionOfContinuity(Scene): def label_spaces(self): input_space = TextMobject("Input Space") input_space.to_edge(UP) - input_space.shift(LEFT*SPACE_WIDTH/2) + input_space.shift(LEFT*SPACE_X_RADIUS/2) output_space = TextMobject("Output Space") output_space.to_edge(UP) - output_space.shift(RIGHT*SPACE_WIDTH/2) + output_space.shift(RIGHT*SPACE_X_RADIUS/2) line = Line( - UP*SPACE_HEIGHT, DOWN*SPACE_HEIGHT, + UP*SPACE_Y_RADIUS, DOWN*SPACE_Y_RADIUS, color = WHITE ) self.play( @@ -1012,7 +1012,7 @@ class ThreeThingsToProve(Scene): class TilingSpace(Scene): def construct(self): coords_set = [ORIGIN] - for n in range(int(2*SPACE_WIDTH)): + for n in range(int(2*SPACE_X_RADIUS)): for vect in UP, RIGHT: for k in range(n): new_coords = coords_set[-1]+((-1)**n)*vect diff --git a/old_projects/hilbert/section3.py b/old_projects/hilbert/section3.py index 82309d67..d112a302 100644 --- a/old_projects/hilbert/section3.py +++ b/old_projects/hilbert/section3.py @@ -68,10 +68,10 @@ class InfiniteResultsFiniteWorld(Scene): right_mobs = [right_words, right_formula] for mob in left_mobs: mob.to_edge(RIGHT, buff = 1) - mob.shift(SPACE_WIDTH*LEFT) + mob.shift(SPACE_X_RADIUS*LEFT) for mob in right_mobs: mob.to_edge(LEFT, buff = 1) - mob.shift(SPACE_WIDTH*RIGHT) + mob.shift(SPACE_X_RADIUS*RIGHT) arrow = Arrow(left_words, right_words) right_overwords.next_to(right_formula, UP) diff --git a/old_projects/inventing_math.py b/old_projects/inventing_math.py index b5f7897d..723cde3a 100644 --- a/old_projects/inventing_math.py +++ b/old_projects/inventing_math.py @@ -167,7 +167,7 @@ class IntroduceDivergentSum(Scene): brace.stretch_to_fit_width( max(equation[x].points[:,0]) - min_x_coord ) - brace.to_edge(LEFT, buff = SPACE_WIDTH+min_x_coord) + brace.to_edge(LEFT, buff = SPACE_X_RADIUS+min_x_coord) if sum_value: self.remove(sum_value) sum_value = TexMobject(str(2**(x+1) - 1)) @@ -180,7 +180,7 @@ class IntroduceDivergentSum(Scene): ) end_brace = deepcopy(brace).stretch_to_fit_width( max(ellipses.points[:,0])-min_x_coord - ).to_edge(LEFT, buff = SPACE_WIDTH+min_x_coord) + ).to_edge(LEFT, buff = SPACE_X_RADIUS+min_x_coord) kwargs = {"run_time" : 5.0, "rate_func" : rush_into} flip_through = FlipThroughNumbers( lambda x : 2**(x+1)-1, @@ -204,7 +204,7 @@ class ClearlyNonsense(Scene): number_line = NumberLine().add_numbers() div_sum = divergent_sum() this_way = TextMobject("Sum goes this way...") - this_way.to_edge(LEFT).shift(RIGHT*(SPACE_WIDTH+1) + DOWN) + this_way.to_edge(LEFT).shift(RIGHT*(SPACE_X_RADIUS+1) + DOWN) how_here = TextMobject("How does it end up here?") how_here.shift(1.5*UP+LEFT) neg_1_arrow = Arrow( @@ -212,7 +212,7 @@ class ClearlyNonsense(Scene): tail=how_here.get_center()+0.5*DOWN ) right_arrow = Arrow( - (SPACE_WIDTH-0.5)*RIGHT + DOWN, + (SPACE_X_RADIUS-0.5)*RIGHT + DOWN, tail = (max(this_way.points[:,0]), -1, 0) ) how_here.highlight("red") @@ -303,7 +303,7 @@ class OutlineOfVideo(Scene): # # """ # # ], size = "\\Small") # # text.scale(1.5).to_edge(LEFT).shift(UP).highlight("white") -# # text.highlight("green", lambda (x, y, z) : x < -SPACE_WIDTH + 1) +# # text.highlight("green", lambda (x, y, z) : x < -SPACE_X_RADIUS + 1) # # line_one_first, equation, line_one_last, line_two = text.split() # # line_two.shift(2*DOWN) # # div_sum = divergent_sum().scale(0.5).shift(3*UP) @@ -390,7 +390,7 @@ class YouAsMathematician(Scene): self.clear() self.play( ApplyPointwiseFunction( - lambda p : 3*SPACE_WIDTH*p/np.linalg.norm(p), + lambda p : 3*SPACE_X_RADIUS*p/np.linalg.norm(p), everything ), *[ @@ -779,7 +779,7 @@ class CircleZoomInOnOne(Scene): class ZoomInOnOne(Scene): def construct(self): num_iterations = 8 - number_line = NumberLine(interval_size = 1, radius = SPACE_WIDTH+2) + number_line = NumberLine(interval_size = 1, radius = SPACE_X_RADIUS+2) number_line.filter_out(lambda (x, y, z):abs(y)>0.1) nl_with_nums = deepcopy(number_line).add_numbers() self.play(ApplyMethod(nl_with_nums.shift, 2*LEFT)) @@ -860,8 +860,8 @@ class DefineInfiniteSum(Scene): bottom = (min(expression.points[:,1]) - buff)*UP side = (max(expression.points[:,0]) + buff)*RIGHT lines = [ - Line(SPACE_WIDTH*LEFT+bottom, side+bottom), - Line(SPACE_HEIGHT*UP+side, side+bottom) + Line(SPACE_X_RADIUS*LEFT+bottom, side+bottom), + Line(SPACE_Y_RADIUS*UP+side, side+bottom) ] self.play(*[ ShowCreation(line.highlight("white")) @@ -963,8 +963,8 @@ class SeekMoreGeneralTruths(Scene): "&\\sum_{n = 0}^\\infty" + summand + "= ? \\\\" for summand in summands ], size = "") - sums.stretch_to_fit_height(2*SPACE_HEIGHT-1) - sums.shift((SPACE_HEIGHT-0.5-max(sums.points[:,1]))*UP) + sums.stretch_to_fit_height(2*SPACE_Y_RADIUS-1) + sums.shift((SPACE_Y_RADIUS-0.5-max(sums.points[:,1]))*UP) for qsum in sums.split(): qsum.sort_points(lambda p : np.dot(p, DOWN+RIGHT)) @@ -1355,7 +1355,7 @@ class SumPowersOfTwoAnimation(Scene): dot = Dot(density = 3*DEFAULT_POINT_DENSITY_1D).scale(1.5) dot_width = dot.get_width()*RIGHT dot_buff = 0.2*RIGHT - left = (SPACE_WIDTH-1)*LEFT + left = (SPACE_X_RADIUS-1)*LEFT right = left + 2*dot_width + dot_buff top_brace_left = left+dot_width+dot_buff+0.3*DOWN bottom_brace_left = left + 0.3*DOWN @@ -1739,8 +1739,8 @@ class RoomsAndSubrooms(Scene): class RoomsAndSubroomsWithNumbers(Scene): def construct(self): - zero_local = (SPACE_WIDTH-0.5)*LEFT - zero_one_width = SPACE_WIDTH-0.3 + zero_local = (SPACE_X_RADIUS-0.5)*LEFT + zero_one_width = SPACE_X_RADIUS-0.3 zero, power_mobs = self.draw_numbers(zero_local, zero_one_width) self.wait() @@ -1782,7 +1782,7 @@ class RoomsAndSubroomsWithNumbers(Scene): rectangles = [] for n in range(4): rect = Rectangle( - 2*SPACE_HEIGHT-(n+2)*upper_buff, + 2*SPACE_Y_RADIUS-(n+2)*upper_buff, zero_one_width/(2**n)-0.85*(n+1)*side_buff ) rect.sort_points(np.linalg.norm) @@ -2049,12 +2049,12 @@ class PAdicMetric(Scene): class FuzzyDiscoveryToNewMath(Scene): def construct(self): fuzzy = TextMobject("Fuzzy Discovery") - fuzzy.to_edge(UP).shift(SPACE_WIDTH*LEFT/2) + fuzzy.to_edge(UP).shift(SPACE_X_RADIUS*LEFT/2) new_math = TextMobject("New Math") - new_math.to_edge(UP).shift(SPACE_WIDTH*RIGHT/2) + new_math.to_edge(UP).shift(SPACE_X_RADIUS*RIGHT/2) lines = Mobject( - Line(DOWN*SPACE_HEIGHT, UP*SPACE_HEIGHT), - Line(3*UP+LEFT*SPACE_WIDTH, 3*UP+RIGHT*SPACE_WIDTH) + Line(DOWN*SPACE_Y_RADIUS, UP*SPACE_Y_RADIUS), + Line(3*UP+LEFT*SPACE_X_RADIUS, 3*UP+RIGHT*SPACE_X_RADIUS) ) fuzzy_discoveries = [ TexMobject("a^2 + b^2 = c^2"), @@ -2094,7 +2094,7 @@ class FuzzyDiscoveryToNewMath(Scene): math.scale(0.65) for mob in disc, math: mob.to_edge(LEFT).shift(count*UP) - math.shift(SPACE_WIDTH*RIGHT) + math.shift(SPACE_X_RADIUS*RIGHT) midpoints.append(count*UP) self.add(fuzzy, lines) diff --git a/old_projects/leibniz.py b/old_projects/leibniz.py index 714f1fa6..2b205603 100644 --- a/old_projects/leibniz.py +++ b/old_projects/leibniz.py @@ -55,14 +55,14 @@ class LatticePointScene(Scene): } def setup(self): if self.x_radius is None: - self.x_radius = self.y_radius*SPACE_WIDTH/SPACE_HEIGHT + self.x_radius = self.y_radius*SPACE_X_RADIUS/SPACE_Y_RADIUS plane = ComplexPlane( y_radius = self.y_radius, x_radius = self.x_radius, secondary_line_ratio = self.secondary_line_ratio, radius = self.plane_color ) - plane.scale_to_fit_height(2*SPACE_HEIGHT) + plane.scale_to_fit_height(2*SPACE_Y_RADIUS) plane.shift(self.plane_center) self.add(plane) self.plane = plane @@ -148,8 +148,8 @@ class LatticePointScene(Scene): ]) def add_axis_labels(self, spacing = 2): - x_max = int(self.plane.point_to_coords(SPACE_WIDTH*RIGHT)[0]) - y_max = int(self.plane.point_to_coords(SPACE_HEIGHT*UP)[1]) + x_max = int(self.plane.point_to_coords(SPACE_X_RADIUS*RIGHT)[0]) + y_max = int(self.plane.point_to_coords(SPACE_Y_RADIUS*UP)[1]) x_range = range(spacing, x_max, spacing) y_range = range(spacing, y_max, spacing) for r in x_range, y_range: @@ -226,7 +226,7 @@ class Introduction(PiCreatureScene): self.play( Write(primes, run_time = 2), morty.change_mode, "happy", - video.scale_to_fit_height, 2*SPACE_WIDTH, + video.scale_to_fit_height, 2*SPACE_X_RADIUS, video.center, video.set_fill, None, 0 ) @@ -664,7 +664,7 @@ class Outline(PiCreatureScene): value.next_to(arrow, DOWN) numerators.add(value) group = VGroup(chis, arrows, numerators) - group.scale_to_fit_width(1.3*SPACE_WIDTH) + group.scale_to_fit_width(1.3*SPACE_X_RADIUS) group.to_corner(DOWN+LEFT) self.play(FadeIn(self.steps[3])) @@ -1106,7 +1106,7 @@ class CountThroughRings(LatticePointScene): ]) top_list.highlight(YELLOW) top_list.arrange_submobjects(RIGHT, aligned_edge = DOWN) - top_list.scale_to_fit_width(2*SPACE_WIDTH - MED_LARGE_BUFF) + top_list.scale_to_fit_width(2*SPACE_X_RADIUS - MED_LARGE_BUFF) top_list.to_edge(UP, buff = SMALL_BUFF) top_rect = BackgroundRectangle(top_list) @@ -1351,11 +1351,11 @@ class Given2DThinkComplex(TeacherStudentsScene): def construct(self): tex = TextMobject("2D $\\Leftrightarrow$ Complex numbers") plane = ComplexPlane( - x_radius = 0.6*SPACE_WIDTH, - y_radius = 0.6*SPACE_HEIGHT, + x_radius = 0.6*SPACE_X_RADIUS, + y_radius = 0.6*SPACE_Y_RADIUS, ) plane.add_coordinates() - plane.scale_to_fit_height(SPACE_HEIGHT) + plane.scale_to_fit_height(SPACE_Y_RADIUS) plane.to_corner(UP+LEFT) self.teacher_says(tex) @@ -2507,7 +2507,7 @@ class IntroduceRecipe(Scene): for tex, color in zip(strings, colors): title.highlight_by_tex(tex, color, substring = False) title.to_edge(UP, buff = MED_SMALL_BUFF) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title, h_line) N_mob = title.get_part_by_tex(self.N_string) @@ -2542,7 +2542,7 @@ class IntroduceRecipe(Scene): factorization = TexMobject( "=", *map(self.complex_number_to_tex, factors) ) - max_width = 2*SPACE_WIDTH - 2 + max_width = 2*SPACE_X_RADIUS - 2 if factorization.get_width() > max_width: factorization.scale_to_fit_width(max_width) factorization.next_to( @@ -3563,7 +3563,7 @@ class IntroduceChi(FactorizationPattern): value.next_to(arrow, UP) numbers.add(value) group = VGroup(chis, arrows, numbers) - group.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + group.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) group.to_edge(DOWN, buff = LARGE_BUFF) self.play(*[ @@ -4007,7 +4007,7 @@ class ExpandCountWith45(SummarizeCountingRule): expansion.add(plus) expansion.add(rp) expansion.arrange_submobjects(RIGHT, buff = SMALL_BUFF) - expansion.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + expansion.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) expansion.next_to(ORIGIN, UP) rect = BackgroundRectangle(expansion) rect.stretch_in_place(1.5, 1) @@ -4252,7 +4252,7 @@ class CountLatticePointsInBigCircle(LatticePointScene): TexMobject("\\sqrt{R^2}") ) radicals.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF) - radicals.scale_to_fit_height(2*SPACE_HEIGHT - MED_LARGE_BUFF) + radicals.scale_to_fit_height(2*SPACE_Y_RADIUS - MED_LARGE_BUFF) radicals.to_edge(DOWN, buff = MED_SMALL_BUFF) radicals.to_edge(LEFT) for radical in radicals: @@ -4279,7 +4279,7 @@ class AddUpGrid(Scene): self.add(self.radicals) def add_row_lines(self): - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH - MED_LARGE_BUFF) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS - MED_LARGE_BUFF) h_line.set_stroke(WHITE, 1) row_lines = VGroup(*[ h_line.copy().next_to( @@ -4430,7 +4430,7 @@ class AddUpGrid(Scene): fill_color = average_color(BLUE_E, BLACK), fill_opacity = 1, height = 1.15, - width = 2*SPACE_WIDTH - 2*MED_SMALL_BUFF, + width = 2*SPACE_X_RADIUS - 2*MED_SMALL_BUFF, ) rect.move_to(3*LEFT, LEFT) rect.to_edge(UP, buff = SMALL_BUFF) @@ -4472,7 +4472,7 @@ class AddUpGrid(Scene): for column, term in zip(chi_mob_columns, full_sum): rect = SurroundingRectangle(column) - rect.stretch_to_fit_height(2*SPACE_HEIGHT) + rect.stretch_to_fit_height(2*SPACE_Y_RADIUS) rect.move_to(column, UP) rect.set_stroke(width = 0) rect.set_fill(YELLOW, 0.3) @@ -4492,7 +4492,7 @@ class AddUpGrid(Scene): if term is full_sum[2]: vect = sum([ self.count_rect.get_left()[0], - SPACE_WIDTH, + SPACE_X_RADIUS, -MED_SMALL_BUFF, ])*LEFT self.play(*[ @@ -4654,7 +4654,7 @@ class IntersectionOfTwoFields(TeacherStudentsScene): circle.set_fill(color, opacity = 0.3) circle.stretch_to_fit_width(7) circle.stretch_to_fit_height(4) - circle.shift(SPACE_WIDTH*vect/3.0 + LEFT) + circle.shift(SPACE_X_RADIUS*vect/3.0 + LEFT) title = TextMobject("%s \\\\ number theory"%adj) title.scale(0.7) title.move_to(circle) diff --git a/old_projects/matrix_as_transform_2d.py b/old_projects/matrix_as_transform_2d.py index 4dd89a50..74758395 100644 --- a/old_projects/matrix_as_transform_2d.py +++ b/old_projects/matrix_as_transform_2d.py @@ -58,7 +58,7 @@ class ShowMultiplication(NumberLineScene): "stroke_width" : 2*DEFAULT_POINT_THICKNESS } if abs(num) < 1: - config["numerical_radius"] = SPACE_WIDTH/num + config["numerical_radius"] = SPACE_X_RADIUS/num NumberLineScene.construct(self, **config) if show_original_line: @@ -159,8 +159,8 @@ class ShowTwoThenThree(ShowMultiplication): class TransformScene2D(Scene): def add_number_plane(self, density_factor = 1, use_faded_lines = True): config = { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "density" : DEFAULT_POINT_DENSITY_1D*density_factor, "stroke_width" : 2*DEFAULT_POINT_THICKNESS } @@ -315,8 +315,8 @@ class ExamplesOfNonlinearTwoDimensionalTransformations(Scene): def apply_function(self, function, explanation): self.clear() config = { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_WIDTH, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_X_RADIUS, "density" : 3*DEFAULT_POINT_DENSITY_1D, "stroke_width" : 2*DEFAULT_POINT_THICKNESS } @@ -369,8 +369,8 @@ class ExamplesOfNonlinearTwoDimensionalTransformations(Scene): class TrickyExamplesOfNonlinearTwoDimensionalTransformations(Scene): def construct(self): config = { - "x_radius" : 1.2*SPACE_WIDTH, - "y_radius" : 1.2*SPACE_WIDTH, + "x_radius" : 1.2*SPACE_X_RADIUS, + "y_radius" : 1.2*SPACE_X_RADIUS, "density" : 10*DEFAULT_POINT_DENSITY_1D, "stroke_width" : 2*DEFAULT_POINT_THICKNESS } @@ -381,12 +381,12 @@ class TrickyExamplesOfNonlinearTwoDimensionalTransformations(Scene): ]).to_edge(UP, buff = 1.5).split() phrase2.highlight(LIGHT_RED) diagonal = Line( - DOWN*SPACE_HEIGHT+LEFT*SPACE_WIDTH, - UP*SPACE_HEIGHT+RIGHT*SPACE_WIDTH, + DOWN*SPACE_Y_RADIUS+LEFT*SPACE_X_RADIUS, + UP*SPACE_Y_RADIUS+RIGHT*SPACE_X_RADIUS, density = 10*DEFAULT_POINT_DENSITY_1D ) def sunrise((x, y, z)): - return ((SPACE_HEIGHT+y)*x, y, z) + return ((SPACE_Y_RADIUS+y)*x, y, z) def squished((x, y, z)): return (x + np.sin(x), y+np.sin(y), z) diff --git a/old_projects/moser_intro.py b/old_projects/moser_intro.py index b2da10fa..a69a5569 100644 --- a/old_projects/moser_intro.py +++ b/old_projects/moser_intro.py @@ -12,7 +12,7 @@ from constants import * from mobject.region import * from scene import Scene -RADIUS = SPACE_HEIGHT - 0.1 +RADIUS = SPACE_Y_RADIUS - 0.1 CIRCLE_DENSITY = DEFAULT_POINT_DENSITY_1D*RADIUS @@ -231,7 +231,7 @@ def next_few_videos(*radians): "black", lambda point : np.linalg.norm(point) < 0.5 ) - big_frame = deepcopy(frame).scale(SPACE_WIDTH) + big_frame = deepcopy(frame).scale(SPACE_X_RADIUS) frame.shift((-5, 0, 0)) sc.add(thumbnail) diff --git a/old_projects/moser_main.py b/old_projects/moser_main.py index 7a805f37..c6666952 100644 --- a/old_projects/moser_main.py +++ b/old_projects/moser_main.py @@ -16,7 +16,7 @@ from mobject.region import * from scene import Scene, GraphScene, PascalsTriangleScene from script_wrapper import command_line_create_scene -RADIUS = SPACE_HEIGHT - 0.1 +RADIUS = SPACE_Y_RADIUS - 0.1 CIRCLE_DENSITY = DEFAULT_POINT_DENSITY_1D*RADIUS MOVIE_PREFIX = "moser/" RADIANS = np.arange(0, 6, 6.0/7) @@ -53,7 +53,7 @@ class CircleScene(Scene): self.lines = [Line(p1, p2) for p1, p2 in it.combinations(self.points, 2)] self.n_equals = TexMobject( "n=%d"%len(radians), - ).shift((-SPACE_WIDTH+1, SPACE_HEIGHT-1.5, 0)) + ).shift((-SPACE_X_RADIUS+1, SPACE_Y_RADIUS-1.5, 0)) self.add(self.circle, self.n_equals, *self.dots + self.lines) @@ -151,7 +151,7 @@ class MoserPattern(CircleScene): self.remove(*self.dots + self.lines + [self.n_equals]) n_equals, num = TexMobject(["n=", "10"]).split() for mob in n_equals, num: - mob.shift((-SPACE_WIDTH + 1.5, SPACE_HEIGHT - 1.5, 0)) + mob.shift((-SPACE_X_RADIUS + 1.5, SPACE_Y_RADIUS - 1.5, 0)) self.add(n_equals) for n in range(1, len(radians)+1): self.add(*self.dots[:n]) @@ -206,7 +206,7 @@ class HardProblemsSimplerQuestions(Scene): mob.scale(scale_factor) fermat["2"].shift(right_center) fermat["3"].shift(left_center) - fermat["n"].shift((0, SPACE_HEIGHT - 1, 0)) + fermat["n"].shift((0, SPACE_Y_RADIUS - 1, 0)) shift_val = right_center - fermat2.get_center() fermat2.shift(shift_val) fermat2_jargon.shift(shift_val) @@ -269,10 +269,10 @@ class HardProblemsSimplerQuestions(Scene): self.play( Transform( all_mobjects, - Point((SPACE_WIDTH, 0, 0)) + Point((SPACE_X_RADIUS, 0, 0)) ), Transform( - Point((-SPACE_WIDTH, 0, 0)), + Point((-SPACE_X_RADIUS, 0, 0)), Mobject(*CircleScene(RADIANS).mobjects) ) ) @@ -526,7 +526,7 @@ class IllustrateNChooseK(Scene): for mob in nrange_mobs: mob.shift((0, 2, 0)) for mob in form1, count, form2: - mob.scale(0.75).shift((0, -SPACE_HEIGHT + 1, 0)) + mob.scale(0.75).shift((0, -SPACE_Y_RADIUS + 1, 0)) count_center = count.get_center() for mob in tuple_mobs: mob.scale(0.6) @@ -587,7 +587,7 @@ class IntersectionPointCorrespondances(CircleScene): for mob in line_statement, dots_statement: mob.center() mob.scale(0.7) - mob.shift((SPACE_WIDTH-2, SPACE_HEIGHT - 1, 0)) + mob.shift((SPACE_X_RADIUS-2, SPACE_Y_RADIUS - 1, 0)) fade_outs = [] line_highlights = [] dot_highlights = [] @@ -682,7 +682,7 @@ class GraphsAndEulersFormulaJoke(Scene): lambda t : (10*t, ((10*t)**3 - 10*t), 0), expected_measure = 40.0 ) - graph.filter_out(lambda (x, y, z) : abs(y) > SPACE_HEIGHT) + graph.filter_out(lambda (x, y, z) : abs(y) > SPACE_Y_RADIUS) self.add(axes) self.play(ShowCreation(graph), run_time = 1.0) eulers = TexMobject("e^{\pi i} = -1").shift((0, 3, 0)) @@ -694,11 +694,11 @@ class GraphsAndEulersFormulaJoke(Scene): self.add(eulers) self.play(CounterclockwiseTransform( Mobject(axes, graph), - Point((-SPACE_WIDTH, SPACE_HEIGHT, 0)) + Point((-SPACE_X_RADIUS, SPACE_Y_RADIUS, 0)) )) self.play(CounterclockwiseTransform( eulers, - Point((SPACE_WIDTH, SPACE_HEIGHT, 0)) + Point((SPACE_X_RADIUS, SPACE_Y_RADIUS, 0)) )) class DefiningGraph(GraphScene): @@ -785,7 +785,7 @@ class EulersFormula(GraphScene): for key, mob in zip(terms, TexMobjects(terms)) ]) for mob in form.values(): - mob.shift((0, SPACE_HEIGHT-0.7, 0)) + mob.shift((0, SPACE_Y_RADIUS-0.7, 0)) formula = Mobject(*[form[k] for k in form.keys() if k != "=2"]) new_form = dict([ (key, deepcopy(mob).shift((0, -0.7, 0))) @@ -882,7 +882,7 @@ class ShowMoserGraphLines(CircleScene): r"{n \choose 2}",r"&+2{n \choose 4}\\",r"&+n" ]).split() for mob in n, plus_n_choose_4, n_choose_2, plus_2_n_choose_4, plus_n: - mob.shift((SPACE_WIDTH - 2, SPACE_HEIGHT-1, 0)) + mob.shift((SPACE_X_RADIUS - 2, SPACE_Y_RADIUS-1, 0)) self.chop_lines_at_intersection_points() self.add(*self.intersection_dots) small_lines = [ @@ -1143,7 +1143,7 @@ class ApplyEulerToMoser(CircleScene): self.play( Transform( Mobject(plus2[4], n1[4], minus[4], n[4]), - Point((SPACE_WIDTH, SPACE_HEIGHT, 0)) + Point((SPACE_X_RADIUS, SPACE_Y_RADIUS, 0)) ), *[ Transform(d[4], d[5]) @@ -1301,7 +1301,7 @@ class PascalsTriangleNChooseKExample(PascalsTriangleScene): formula_terms = left, n_mob, k_mob, right = TexMobject([ r"\left(", str(n), r"\atop %d"%k, r"\right)" ]) - formula_center = (SPACE_WIDTH - 1, SPACE_HEIGHT - 1, 0) + formula_center = (SPACE_X_RADIUS - 1, SPACE_Y_RADIUS - 1, 0) self.remove(*triangle_terms) self.add(*formula_terms) self.wait() @@ -1486,7 +1486,7 @@ class MoserSolutionInPascal(PascalsTriangleScene): self.remove(*above_terms) self.wait() terms_sum = TexMobject(str(moser_function(n))) - terms_sum.shift((SPACE_WIDTH-1, terms[0].get_center()[1], 0)) + terms_sum.shift((SPACE_X_RADIUS-1, terms[0].get_center()[1], 0)) terms_sum.highlight(term_color) self.play(Transform(Mobject(*terms), terms_sum)) @@ -1541,7 +1541,7 @@ class ExplainNChoose2Formula(Scene): str(n), "(%d-1)"%n, r"\over{2}" ]).split() for part in n_mob, n_minus_1, over_2: - part.shift((SPACE_WIDTH-1.5, SPACE_HEIGHT-1, 0)) + part.shift((SPACE_X_RADIUS-1.5, SPACE_Y_RADIUS-1, 0)) self.add(parens, n_mob) up_unit = np.array((0, height, 0)) @@ -1685,7 +1685,7 @@ class IntersectionChoppingExamples(Scene): for pairs, exp in [(pairs1, "3 + 2(2) = 7"), (pairs2, "4 + 2(3) = 10")]: lines = [Line(*pair).scale(2) for pair in pairs] - self.add(TexMobject(exp).shift((0, SPACE_HEIGHT-1, 0))) + self.add(TexMobject(exp).shift((0, SPACE_Y_RADIUS-1, 0))) self.add(*lines) self.wait() self.play(*[ diff --git a/old_projects/mug.py b/old_projects/mug.py index f58c6a6f..579566e2 100644 --- a/old_projects/mug.py +++ b/old_projects/mug.py @@ -47,7 +47,7 @@ class HappyHolidays(TeacherStudentsScene): self.add(self.get_snowflakes()) self.change_student_modes( *["hooray"]*3, - look_at_arg = SPACE_HEIGHT*UP, + look_at_arg = SPACE_Y_RADIUS*UP, added_anims = [self.teacher.change, "hooray"] ) self.play(LaggedStart( @@ -55,7 +55,7 @@ class HappyHolidays(TeacherStudentsScene): ), Animation(self.pi_creatures)) self.change_student_modes( "happy", "wave_2", "wave_1", - look_at_arg = SPACE_HEIGHT*UP, + look_at_arg = SPACE_Y_RADIUS*UP, ) self.look_at(self.teacher.get_corner(UP+LEFT)) self.wait(2) @@ -94,7 +94,7 @@ class HappyHolidays(TeacherStudentsScene): ]) def random_confetti_spiral(mob, **kwargs): return ConfettiSpiril( - mob, x_start = 2*random.random()*SPACE_WIDTH - SPACE_WIDTH, + mob, x_start = 2*random.random()*SPACE_X_RADIUS - SPACE_X_RADIUS, **kwargs ) snowflake_spirils = LaggedStart( @@ -286,7 +286,7 @@ class AboutToyPuzzles(UtilitiesPuzzleScene, TeacherStudentsScene, ThreeDScene): objects.generate_target() objects.target.scale(0.5) objects.target.move_to( - (SPACE_HEIGHT*DOWN + SPACE_WIDTH*LEFT)/2 + (SPACE_Y_RADIUS*DOWN + SPACE_X_RADIUS*LEFT)/2 ) eulers = TexMobject(*"V-E+F=2") @@ -1079,7 +1079,7 @@ class LightUpNodes(IntroduceRegions): TextMobject("\\# Regions"), ] for title, vect in zip(titles, [LEFT, ORIGIN, RIGHT]): - title.shift(SPACE_WIDTH*vect/2) + title.shift(SPACE_X_RADIUS*vect/2) title.to_edge(UP) underline = Line(LEFT, RIGHT) underline.stretch_to_fit_width(title.get_width()) diff --git a/old_projects/music_and_measure.py b/old_projects/music_and_measure.py index 83b26abf..ecdf47c8 100644 --- a/old_projects/music_and_measure.py +++ b/old_projects/music_and_measure.py @@ -491,7 +491,7 @@ class LongSine(Mobject1D): class DecomposeMusicalNote(Scene): def construct(self): - line = Line(SPACE_HEIGHT*DOWN, SPACE_HEIGHT*UP) + line = Line(SPACE_Y_RADIUS*DOWN, SPACE_Y_RADIUS*UP) sine = LongSine() kwargs = { "run_time" : 4.0, @@ -513,7 +513,7 @@ class DecomposeMusicalNote(Scene): class DecomposeTwoFrequencies(Scene): def construct(self): - line = Line(SPACE_HEIGHT*DOWN, SPACE_HEIGHT*UP) + line = Line(SPACE_Y_RADIUS*DOWN, SPACE_Y_RADIUS*UP) sine1 = LongSine().shift(2*UP).highlight("yellow") sine2 = LongSine().shift(DOWN).highlight("lightgreen") sine1.stretch(2.0/3, 0) @@ -556,11 +556,11 @@ class PatternInFrequencies(Scene): return "%d_to_%d"%(num1, num2) def construct(self, num1, num2, color): - big_line = Line(SPACE_HEIGHT*UP, SPACE_HEIGHT*DOWN) + big_line = Line(SPACE_Y_RADIUS*UP, SPACE_Y_RADIUS*DOWN) big_line.highlight("white").shift(2*LEFT) line_template = Line(UP, DOWN) line_template.shift(2*UP+2*LEFT) - setup_width = 2*SPACE_WIDTH + setup_width = 2*SPACE_X_RADIUS num_top_lines = int(setup_width) num_bot_lines = int(setup_width*num1/num2) top_lines = Mobject(*[ @@ -667,8 +667,8 @@ class ConstructPiano(Scene): key.stroke_width = 1 key_copy = deepcopy(key).to_corner(DOWN+LEFT) key_copy.scale_in_place(0.25) - key_copy.shift(1.8*random.random()*SPACE_WIDTH*RIGHT) - key_copy.shift(1.8*random.random()*SPACE_HEIGHT*UP) + key_copy.shift(1.8*random.random()*SPACE_X_RADIUS*RIGHT) + key_copy.shift(1.8*random.random()*SPACE_Y_RADIUS*UP) key_copy.rotate(2*np.pi*random.random()) anims.append(Transform(key_copy, key)) self.play(*anims, run_time = 3.0) @@ -762,7 +762,7 @@ class PianoTuning(Scene): class PowersOfTwelfthRoot(Scene): def construct(self): - max_height = SPACE_HEIGHT-0.5 + max_height = SPACE_Y_RADIUS-0.5 min_height = -max_height num_terms = 11 mob_list = [] @@ -883,9 +883,9 @@ class AllValuesBetween1And2(NumberLineScene): self.wait(0.5) points = map(self.number_line.number_to_point, [approx, irrational]) distance = np.linalg.norm(points[1]-points[0]) - if distance < 0.3*SPACE_WIDTH and num_zooms < max_num_zooms: + if distance < 0.3*SPACE_X_RADIUS and num_zooms < max_num_zooms: num_zooms += 1 - new_distance = 0.75*SPACE_WIDTH + new_distance = 0.75*SPACE_X_RADIUS self.zoom_in_on(irrational, new_distance/distance) for mob in irr_mob, bot_arrow: mob.shift(mob.get_center()[0]*LEFT) @@ -1005,7 +1005,7 @@ class SumOfIntervalsMustBeLessThan1(IntervalScene): IntervalScene.construct(self) self.add_fraction_ticks() anims = [] - last_plus = Point((SPACE_WIDTH-0.5)*LEFT+2*UP) + last_plus = Point((SPACE_X_RADIUS-0.5)*LEFT+2*UP) for num in np.arange(0, 1.1, .1): open_interval, line = self.add_open_interval(num, 0.1) self.remove(line) @@ -1159,7 +1159,7 @@ class StepsToSolution(IntervalScene): denom_to_mobs[frac.denominator].append(mob) mob_copy = deepcopy(mob).center() mob_copy.shift((2.4-mob_copy.get_bottom()[1])*UP) - mob_copy.shift((-SPACE_WIDTH+self.spacing*count)*RIGHT) + mob_copy.shift((-SPACE_X_RADIUS+self.spacing*count)*RIGHT) comma = TextMobject(",").next_to(mob_copy, buff = 0.1, aligned_edge = DOWN) anims.append(Transform(mob, mob_copy)) commas.add(comma) @@ -1167,7 +1167,7 @@ class StepsToSolution(IntervalScene): new_ticks = [] for tick, count in zip(ticks.split(), it.count(1)): tick_copy = deepcopy(tick).center().shift(1.6*UP) - tick_copy.shift((-SPACE_WIDTH+self.spacing*count)*RIGHT) + tick_copy.shift((-SPACE_X_RADIUS+self.spacing*count)*RIGHT) new_ticks.append(tick_copy) new_ticks = Mobject(*new_ticks) anims.append(DelayByOrder(Transform(ticks, new_ticks))) @@ -1194,7 +1194,7 @@ class StepsToSolution(IntervalScene): self.wait() to_remove = [self.number_line] + self.number_mobs self.play(*[ - ApplyMethod(mob.shift, 2*SPACE_WIDTH*RIGHT) + ApplyMethod(mob.shift, 2*SPACE_X_RADIUS*RIGHT) for mob in to_remove ]) self.remove(*to_remove) diff --git a/old_projects/nn/part1.py b/old_projects/nn/part1.py index 141d54af..6f7432ac 100644 --- a/old_projects/nn/part1.py +++ b/old_projects/nn/part1.py @@ -438,7 +438,7 @@ class ExampleThrees(PiCreatureScene): alt_threes = VGroup(*self.three_mobs[1:]) alt_threes.arrange_submobjects(DOWN) - alt_threes.scale_to_fit_height(2*SPACE_HEIGHT - 2) + alt_threes.scale_to_fit_height(2*SPACE_Y_RADIUS - 2) alt_threes.to_edge(RIGHT) for alt_three in alt_threes: @@ -604,7 +604,7 @@ class WriteAProgram(Scene): choices = VGroup(*[TexMobject(str(n)) for n in range(10)]) choices.arrange_submobjects(DOWN) - choices.scale_to_fit_height(2*SPACE_HEIGHT - 1) + choices.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) choices.next_to(arrow, RIGHT) self.play( @@ -885,7 +885,7 @@ class AlternateNeuralNetworks(PiCreatureScene): ex[0].next_to(arrow, LEFT) ex[1].next_to(arrow, RIGHT) ex.submobjects.insert(1, arrow) - examples.scale_to_fit_width(2*SPACE_WIDTH - 1) + examples.scale_to_fit_width(2*SPACE_X_RADIUS - 1) examples.next_to(morty, UP).to_edge(RIGHT) maybe_words = TextMobject("Maybe future videos?") @@ -1826,7 +1826,7 @@ class BreakUpMicroPatterns(BreakUpMacroPatterns): edge.save_state() edge[1].set_opacity(0) equation = self.get_equation(loop.target, *edges.target) - equation.scale_to_fit_width(2*SPACE_WIDTH - 1) + equation.scale_to_fit_width(2*SPACE_X_RADIUS - 1) equation.to_edge(UP) symbols = VGroup(*equation[1::2]) @@ -2153,7 +2153,7 @@ class ManyTasksBreakDownLikeThis(TeacherStudentsScene): word ) sequence.arrange_submobjects(RIGHT) - sequence.scale_to_fit_width(2*SPACE_WIDTH - 1) + sequence.scale_to_fit_width(2*SPACE_X_RADIUS - 1) sequence.to_edge(UP) audio_label.next_to(audio, DOWN) @@ -2982,7 +2982,7 @@ class BiasForInactiviyWords(Scene): def construct(self): words = TextMobject("Bias for inactivity") words.highlight(BLUE) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(UP) self.play(Write(words)) @@ -3931,7 +3931,7 @@ class SigmoidAppliedToVector(Scene): \\sigma(x) \\\\ \\sigma(y) \\\\ \\sigma(z) \\end{array}\\right] """) - tex.scale_to_fit_width(2*SPACE_WIDTH - 1) + tex.scale_to_fit_width(2*SPACE_X_RADIUS - 1) tex.to_edge(DOWN) indices = it.chain( [0], range(1, 5), range(16, 16+4), @@ -4421,7 +4421,7 @@ class IntroduceReLU(IntroduceSigmoid): self.play( ApplyMethod( VGroup(cross, sigmoid_title).shift, - SPACE_WIDTH*RIGHT, + SPACE_X_RADIUS*RIGHT, rate_func = running_start ), FadeOut(old_school), @@ -4447,7 +4447,7 @@ class IntroduceReLU(IntroduceSigmoid): graph.highlight(YELLOW) char = self.x_axis_label.replace("$", "") equation = TextMobject("ReLU($%s$) = max$(0, %s)$"%(char, char)) - equation.shift(SPACE_WIDTH*LEFT/2) + equation.shift(SPACE_X_RADIUS*LEFT/2) equation.to_edge(UP) equation.add_background_rectangle() name = TextMobject("Rectified linear unit") @@ -4556,9 +4556,9 @@ class CompareSigmoidReLUOnDeepNetworks(PiCreatureScene): ### def create_pi_creatures(self): morty = Mortimer() - morty.shift(SPACE_WIDTH*RIGHT/2).to_edge(DOWN) + morty.shift(SPACE_X_RADIUS*RIGHT/2).to_edge(DOWN) lisha = PiCreature(color = BLUE_C) - lisha.shift(SPACE_WIDTH*LEFT/2).to_edge(DOWN) + lisha.shift(SPACE_X_RADIUS*LEFT/2).to_edge(DOWN) self.morty, self.lisha = morty, lisha return morty, lisha @@ -4588,7 +4588,7 @@ class Thumbnail(NetworkScene): } def construct(self): network_mob = self.network_mob - network_mob.scale_to_fit_height(2*SPACE_HEIGHT - 1) + network_mob.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) for layer in network_mob.layers: layer.neurons.set_stroke(width = 5) diff --git a/old_projects/nn/part2.py b/old_projects/nn/part2.py index 60d03390..8c2d3fb4 100644 --- a/old_projects/nn/part2.py +++ b/old_projects/nn/part2.py @@ -123,7 +123,7 @@ class ShowPlan(Scene): def construct(self): title = TextMobject("Plan").scale(1.5) title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.highlight(WHITE) h_line.next_to(title, DOWN) self.add(title, h_line) @@ -354,7 +354,7 @@ class PreviewLearning(NetworkScene): class BackpropComingLaterWords(Scene): def construct(self): words = TextMobject("(Backpropagation be \\\\ the next video)") - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) words.to_edge(DOWN) self.add(words) @@ -499,7 +499,7 @@ class MNistDescription(Scene): group.arrange_submobjects_in_grid( n_rows = self.n_rows_per_grid, ) - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) if i == 0: self.play( LaggedStart(FadeIn, group), @@ -1253,9 +1253,9 @@ class EmphasizeComplexityOfCostFunction(IntroduceCostFunction): self.show_cost_function() def setup_sides(self): - v_line = Line(UP, DOWN).scale(SPACE_HEIGHT) + v_line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) network_mob = self.network_mob - network_mob.scale_to_fit_width(SPACE_WIDTH - 1) + network_mob.scale_to_fit_width(SPACE_X_RADIUS - 1) network_mob.to_corner(DOWN+LEFT) self.add(v_line) @@ -1263,7 +1263,7 @@ class EmphasizeComplexityOfCostFunction(IntroduceCostFunction): def show_network_as_a_function(self): title = TextMobject("Neural network function") - title.shift(SPACE_WIDTH*RIGHT/2) + title.shift(SPACE_X_RADIUS*RIGHT/2) title.to_edge(UP) underline = Line(LEFT, RIGHT) underline.stretch_to_fit_width(title.get_width()) @@ -1855,7 +1855,7 @@ class TwoVariableInputSpace(Scene): def add_plane(self): plane = NumberPlane( - x_radius = SPACE_WIDTH/2 + x_radius = SPACE_X_RADIUS/2 ) plane.add_coordinates() name = TextMobject("Input space") @@ -1877,7 +1877,7 @@ class TwoVariableInputSpace(Scene): point = self.plane.coords_to_point(2, 1) dot = Dot(point, color = YELLOW) dot.save_state() - dot.move_to(SPACE_HEIGHT*UP + SPACE_WIDTH*RIGHT/2) + dot.move_to(SPACE_Y_RADIUS*UP + SPACE_X_RADIUS*RIGHT/2) dot.fade(1) arrows = VGroup(*[ Arrow(ORIGIN, vect).shift(point) @@ -1982,7 +1982,7 @@ class GradientDescentAlgorithm(Scene): TextMobject("Repeat."), ) words.arrange_submobjects(DOWN, aligned_edge = LEFT) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_corner(DOWN+LEFT) for word in words[:2]: @@ -1996,7 +1996,7 @@ class GradientDescentName(Scene): def construct(self): words = TextMobject("Gradient descent") words.highlight(BLUE) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(DOWN) self.play(Write(words, run_time = 2)) @@ -2118,7 +2118,7 @@ class ShowFullCostFunctionGradient(PreviewLearning): class DotsInsert(Scene): def construct(self): dots = TexMobject("\\vdots") - dots.scale_to_fit_height(2*SPACE_HEIGHT - 1) + dots.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.add(dots) class HowMinimizingCostMeansBetterTrainingPerformance(IntroduceCostFunction): @@ -2193,7 +2193,7 @@ class NonSpatialGradientIntuition(Scene): "w_color" : YELLOW, "positive_color" : BLUE, "negative_color" : RED, - "vect_height" : SPACE_HEIGHT - MED_LARGE_BUFF, + "vect_height" : SPACE_Y_RADIUS - MED_LARGE_BUFF, "text_scale_value" : 0.7, } def construct(self): @@ -2483,7 +2483,7 @@ class TwoGradientInterpretationsIn2D(Scene): "C(", "x, y", ")", "=", "\\frac{3}{2}x^2", "+", "\\frac{1}{2}y^2", ) - func.shift(SPACE_WIDTH*LEFT/2).to_edge(UP) + func.shift(SPACE_X_RADIUS*LEFT/2).to_edge(UP) grad = TexMobject("\\nabla", "C(", "1, 1", ")", "=") vect = TexMobject( @@ -3051,7 +3051,7 @@ class InterpretFirstWeightMatrixRows(TestPerformance): network_mob.edge_groups[0], network_mob.layers[:2] )) - shift_val = SPACE_WIDTH*LEFT + MED_LARGE_BUFF*RIGHT - \ + shift_val = SPACE_X_RADIUS*LEFT + MED_LARGE_BUFF*RIGHT - \ to_keep.get_left() self.play( to_fade.shift, shift_val, @@ -3075,7 +3075,7 @@ class InterpretFirstWeightMatrixRows(TestPerformance): pixel.set_fill(color, opacity = abs(shade)**(0.3)) pixel_arrays.add(pixel_array) pixel_arrays.arrange_submobjects_in_grid(buff = MED_LARGE_BUFF) - pixel_arrays.scale_to_fit_height(2*SPACE_HEIGHT - 2.5) + pixel_arrays.scale_to_fit_height(2*SPACE_Y_RADIUS - 2.5) pixel_arrays.to_corner(DOWN+RIGHT) for pixel_array in pixel_arrays: @@ -3486,7 +3486,7 @@ class ConvolutionalNetworkPreview(Scene): vect = get_organized_images()[9][0] image = PixelsFromVect(vect) image.set_stroke(width = 1) - image.scale_to_fit_height(2*SPACE_HEIGHT - 1) + image.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.add(image) kernels = [ @@ -3544,7 +3544,7 @@ class RandomlyLabeledImageData(Scene): x = i//5 y = i%5 group = self.get_training_group(image_name, label_name) - group.shift(4.5*LEFT + x*SPACE_WIDTH*RIGHT) + group.shift(4.5*LEFT + x*SPACE_X_RADIUS*RIGHT) group.shift(3*UP + 1.5*y*DOWN) groups.add(group) labels.add(group[-1]) @@ -3728,7 +3728,7 @@ class ManyMinimaWords(Scene): "Many local minima,\\\\", "roughly equal quality" ) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(UP) self.play(Write(words)) self.wait() diff --git a/old_projects/nn/part3.py b/old_projects/nn/part3.py index a4dc705b..13f8cfb8 100644 --- a/old_projects/nn/part3.py +++ b/old_projects/nn/part3.py @@ -7,7 +7,7 @@ class LayOutPlan(Scene): title = TextMobject("Plan") title.scale(1.5) title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH - 1) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS - 1) h_line.next_to(title, DOWN) items = BulletedList( @@ -19,7 +19,7 @@ class LayOutPlan(Scene): self.add(items) rect = ScreenRectangle() - rect.scale_to_fit_width(2*SPACE_WIDTH - items.get_width() - 2) + rect.scale_to_fit_width(2*SPACE_X_RADIUS - items.get_width() - 2) rect.next_to(items, RIGHT, MED_LARGE_BUFF) self.play( @@ -381,7 +381,7 @@ class GetLostInNotation(PiCreatureScene): DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT ) - circle = Circle(radius = 3*SPACE_WIDTH) + circle = Circle(radius = 3*SPACE_X_RADIUS) circle.set_fill(WHITE, 0) circle.set_stroke(WHITE, 0) @@ -1390,7 +1390,7 @@ class WalkThroughTwoExample(ShowAveragingCost): class WriteHebbian(Scene): def construct(self): words = TextMobject("Hebbian theory") - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(UP) self.play(Write(words)) self.wait() @@ -1477,7 +1477,7 @@ class ConstructGradientFromAllTrainingExamples(Scene): def setup_grid(self): h_lines = VGroup(*[ - Line(LEFT, RIGHT).scale(0.85*SPACE_WIDTH) + Line(LEFT, RIGHT).scale(0.85*SPACE_X_RADIUS) for x in range(6) ]) h_lines.arrange_submobjects(DOWN, buff = 1) @@ -1486,7 +1486,7 @@ class ConstructGradientFromAllTrainingExamples(Scene): h_lines.to_edge(LEFT, buff = 0) v_lines = VGroup(*[ - Line(UP, DOWN).scale(SPACE_HEIGHT - MED_LARGE_BUFF) + Line(UP, DOWN).scale(SPACE_Y_RADIUS - MED_LARGE_BUFF) for x in range(self.n_examples + 1) ]) v_lines.arrange_submobjects(RIGHT, buff = 1.4) diff --git a/old_projects/nn/playground.py b/old_projects/nn/playground.py index c8e68720..7ab3423a 100644 --- a/old_projects/nn/playground.py +++ b/old_projects/nn/playground.py @@ -61,7 +61,7 @@ class Test(Scene): # h_group.arrange_submobjects(LEFT) # group.add(h_group) # group.arrange_submobjects(DOWN) - # group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + # group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) # self.add(group) @@ -75,7 +75,7 @@ class Test(Scene): ]).arrange_submobjects(RIGHT) for x in range(10) ]).arrange_submobjects(DOWN) - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.add(group) def show_weight_rows(self, network, index): @@ -88,7 +88,7 @@ class Test(Scene): pixel.set_fill(color, opacity = opacity) group.add(mob) group.arrange_submobjects_in_grid() - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.add(group) def show_all_activation_images(self, network, test_data): @@ -99,7 +99,7 @@ class Test(Scene): image_samples.arrange_submobjects_in_grid( n_rows = 2, buff = LARGE_BUFF ) - image_samples.scale_to_fit_height(2*SPACE_HEIGHT - 1) + image_samples.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.add(image_samples) def get_activation_images(self, digit, network, test_data, n_examples = 8): @@ -115,7 +115,7 @@ class Test(Scene): ]).arrange_submobjects(RIGHT) for vect in input_vectors[:n_examples] ]).arrange_submobjects(DOWN) - activation_iamges.scale_to_fit_height(2*SPACE_HEIGHT - 1) + activation_iamges.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) return activation_iamges def show_two_blend(self): @@ -142,7 +142,7 @@ class Test(Scene): group.arrange_submobjects(DOWN+RIGHT, SMALL_BUFF) groups.add(group) groups.arrange_submobjects_in_grid() - groups.scale_to_fit_height(2*SPACE_HEIGHT - 1) + groups.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.add(groups) def show_test_input(self, network): @@ -153,7 +153,7 @@ class Test(Scene): if test[1] in [4, 9] ]) group.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.play(FadeIn(group)) def get_set(self, network, test): diff --git a/old_projects/number_line_scene.py b/old_projects/number_line_scene.py index 5054f455..d6e6c59e 100644 --- a/old_projects/number_line_scene.py +++ b/old_projects/number_line_scene.py @@ -1,6 +1,6 @@ import numpy as np from animation.transform import ApplyMethod, Transform -from constants import RIGHT, SPACE_WIDTH, UP +from constants import RIGHT, SPACE_X_RADIUS, UP from helpers import counterclockwise_path, straight_path from point_cloud_mobject import Point from scene import Scene @@ -16,7 +16,7 @@ class NumberLineScene(Scene): def zoom_in_on(self, number, zoom_factor, run_time = 2.0): unit_length_to_spatial_width = self.number_line.unit_length_to_spatial_width*zoom_factor - radius = SPACE_WIDTH/unit_length_to_spatial_width + radius = SPACE_X_RADIUS/unit_length_to_spatial_width tick_frequency = 10**(np.floor(np.log10(radius))) left_tick = tick_frequency*(np.ceil((number-radius)/tick_frequency)) new_number_line = NumberLine( diff --git a/old_projects/patreon.py b/old_projects/patreon.py index e5643cf4..7173fa42 100644 --- a/old_projects/patreon.py +++ b/old_projects/patreon.py @@ -92,7 +92,7 @@ class SideGigToFullTime(Scene): self.play( ApplyMethod( dollar_signs.shift, - (SPACE_HEIGHT+1)*DOWN, + (SPACE_Y_RADIUS+1)*DOWN, submobject_mode = "lagged_start" ), morty.change_mode, "guilty", @@ -195,10 +195,10 @@ class TwoTypesOfVideos(Scene): def construct(self): morty = Mortimer().shift(2*DOWN) stand_alone = TextMobject("Standalone videos") - stand_alone.shift(SPACE_WIDTH*LEFT/2) + stand_alone.shift(SPACE_X_RADIUS*LEFT/2) stand_alone.to_edge(UP) series = TextMobject("Series") - series.shift(SPACE_WIDTH*RIGHT/2) + series.shift(SPACE_X_RADIUS*RIGHT/2) series.to_edge(UP) box = Rectangle(width = 16, height = 9, color = WHITE) box.scale_to_fit_height(3) @@ -215,7 +215,7 @@ class TwoTypesOfVideos(Scene): ] ]) series_list.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF) - series_list.scale_to_fit_width(SPACE_WIDTH-2) + series_list.scale_to_fit_width(SPACE_X_RADIUS-2) series_list.next_to(series, DOWN, buff = MED_SMALL_BUFF) series_list.to_edge(RIGHT) diff --git a/old_projects/pi_day.py b/old_projects/pi_day.py index dfbb9568..ff65be23 100644 --- a/old_projects/pi_day.py +++ b/old_projects/pi_day.py @@ -385,7 +385,7 @@ class HartlAndPalais(Scene): color = WHITE, stroke_width = 1, ) - hartl_rect.scale_to_fit_width(SPACE_WIDTH - 1) + hartl_rect.scale_to_fit_width(SPACE_X_RADIUS - 1) hartl_rect.to_edge(LEFT) palais_rect = hartl_rect.copy() palais_rect.to_edge(RIGHT) @@ -505,7 +505,7 @@ class EulerWrites628(Scene): } def construct(self): image = ImageMobject(os.path.join(RESOURCE_DIR, "dalembert_zoom")) - image.scale_to_fit_width(2*SPACE_WIDTH - 1) + image.scale_to_fit_width(2*SPACE_X_RADIUS - 1) image.to_edge(UP, buff = MED_SMALL_BUFF) image.fade(0.15) rect = Rectangle( @@ -591,8 +591,8 @@ class HeroAndVillain(Scene): for mob in pictures: mob.scale_to_fit_height(5) - good_euler.move_to(SPACE_WIDTH*LEFT/2) - bad_euler.move_to(SPACE_WIDTH*RIGHT/2) + good_euler.move_to(SPACE_X_RADIUS*LEFT/2) + bad_euler.move_to(SPACE_X_RADIUS*RIGHT/2) bad_euler_pixelated.move_to(bad_euler) good_euler_label = TextMobject("Leonhard Euler") @@ -626,7 +626,7 @@ class HeroAndVillain(Scene): class AnalysisQuote(Scene): def construct(self): analysis = get_image("Analysis_page_showing_pi") - analysis.scale_to_fit_height(2*SPACE_HEIGHT) + analysis.scale_to_fit_height(2*SPACE_Y_RADIUS) analysis.to_edge(LEFT, buff = 0) text = TextMobject( @@ -642,7 +642,7 @@ class AnalysisQuote(Scene): pi_formula = TexMobject( "\\pi", "=", "{ \\text{semicircumference}", "\\over", "\\text{radius}}" ) - text.scale_to_fit_width(SPACE_WIDTH) + text.scale_to_fit_width(SPACE_X_RADIUS) text.next_to(analysis, RIGHT, LARGE_BUFF) text.to_edge(UP) @@ -767,7 +767,7 @@ class ThingsNamedAfterEuler(Scene): "Euler totient function (number theory)", ])) group.arrange_submobjects(DOWN, aligned_edge = LEFT) - group.scale_to_fit_height(2*SPACE_HEIGHT - 1) + group.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) self.play(LaggedStart(FadeIn, group, lag_ratio = 0.2, run_time = 12)) self.wait() @@ -1036,7 +1036,7 @@ class EndScene(PatreonEndScreen): self.add(watch_basel) # self.add(basel_screen) - line = DashedLine(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + line = DashedLine(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) line.next_to(watch_basel, DOWN) self.add(line) @@ -1061,7 +1061,7 @@ class EndScene(PatreonEndScreen): instagram_logo.next_to(instagram_line, LEFT, SMALL_BUFF) instagram = Group(instagram_logo, instagram_line) instagram.next_to(line, DOWN) - instagram.shift(SPACE_WIDTH*RIGHT/2) + instagram.shift(SPACE_X_RADIUS*RIGHT/2) self.add(instagram) @@ -1096,7 +1096,7 @@ class Thumbnail(Scene): formula.scale(2) pi.scale(1.5, about_edge = RIGHT) formula.set_stroke(BLUE, 1) - formula.scale_to_fit_width(2*SPACE_WIDTH - 2) + formula.scale_to_fit_width(2*SPACE_X_RADIUS - 2) # formula.shift(0.5*RIGHT) self.add(formula) diff --git a/old_projects/putnam.py b/old_projects/putnam.py index 302db6f7..f06d4f8f 100644 --- a/old_projects/putnam.py +++ b/old_projects/putnam.py @@ -48,9 +48,9 @@ class IntroducePutnam(Scene): for mob in six_hours, three_hours: mob.next_to(title, DOWN, MED_LARGE_BUFF) # mob.highlight(BLUE) - three_hours.shift(SPACE_WIDTH*LEFT/2) + three_hours.shift(SPACE_X_RADIUS*LEFT/2) three_hours_copy = three_hours.copy() - three_hours_copy.shift(SPACE_WIDTH*RIGHT) + three_hours_copy.shift(SPACE_X_RADIUS*RIGHT) question_groups = VGroup(*[ VGroup(*[ @@ -58,7 +58,7 @@ class IntroducePutnam(Scene): for i in range(1, 7) ]).arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) for c in "A", "B" - ]).arrange_submobjects(RIGHT, buff = SPACE_WIDTH - MED_SMALL_BUFF) + ]).arrange_submobjects(RIGHT, buff = SPACE_X_RADIUS - MED_SMALL_BUFF) question_groups.to_edge(LEFT) question_groups.to_edge(DOWN, MED_LARGE_BUFF) flat_questions = VGroup(*it.chain(*question_groups)) @@ -67,7 +67,7 @@ class IntroducePutnam(Scene): for questions in question_groups: rect = SurroundingRectangle(questions, buff = MED_SMALL_BUFF) rect.set_stroke(WHITE, 2) - rect.stretch_to_fit_width(SPACE_WIDTH - 1) + rect.stretch_to_fit_width(SPACE_X_RADIUS - 1) rect.move_to(questions.get_left() + MED_SMALL_BUFF*LEFT, LEFT) rects.add(rect) @@ -196,7 +196,7 @@ class NatureOf5sAnd6s(TeacherStudentsScene): ) self.change_student_modes(*["pondering"]*3) self.play(Transform(mover[1], new_words)) - self.look_at((SPACE_WIDTH*RIGHT + SPACE_HEIGHT*UP)/2) + self.look_at((SPACE_X_RADIUS*RIGHT + SPACE_Y_RADIUS*UP)/2) self.wait(4) @@ -239,7 +239,7 @@ class IntroduceTetrahedronSupplement(Scene): question = TextMobject("Probability that this tetrahedron \\\\ contains the sphere's center?") question.next_to(title, DOWN, MED_LARGE_BUFF) group = VGroup(title, question) - group.scale_to_fit_width(2*SPACE_WIDTH-1) + group.scale_to_fit_width(2*SPACE_X_RADIUS-1) group.to_edge(DOWN) for n in range(1, 4): @@ -826,7 +826,7 @@ class AverageSizeOfSphericalTriangleSectionSupplement(Scene): arg_separator = "" ) words.highlight_by_tex("section", GREEN) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(DOWN) self.play(Write(words)) self.wait(3) @@ -1289,7 +1289,7 @@ class ThreeDAnswer(Scene): "Probability that the tetrahedron contains center:", "$\\frac{1}{8}$" ) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(DOWN) words[1].highlight(BLUE) @@ -1531,7 +1531,7 @@ class AddedPromoWords(Scene): "First", "$2^8$", "vistors get", "$(e^\\pi - \\pi)\\%$", "off" ) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_edge(DOWN) words.highlight_by_tex("2^8", YELLOW) words.highlight_by_tex("pi", PINK) diff --git a/old_projects/qa_round_two.py b/old_projects/qa_round_two.py index a1ef9fdf..46ebe486 100644 --- a/old_projects/qa_round_two.py +++ b/old_projects/qa_round_two.py @@ -190,7 +190,7 @@ class PiHoldingScreen(PiCreatureScene): class QuestionsLink(Scene): def construct(self): link = TextMobject("https://3b1b.co/questions") - link.scale_to_fit_width(2*SPACE_WIDTH) + link.scale_to_fit_width(2*SPACE_X_RADIUS) link.to_edge(DOWN) self.play(Write(link)) self.wait() @@ -198,12 +198,12 @@ class QuestionsLink(Scene): class Thumbnail(Scene): def construct(self): equation = TexMobject("2^{19} = " + "{:,}".format(2**19)) - equation.scale_to_fit_width(SPACE_WIDTH) + equation.scale_to_fit_width(SPACE_X_RADIUS) equation.to_edge(DOWN, buff = LARGE_BUFF) q_and_a = TextMobject("Q\\&A \\\\ Round 2") q_and_a.gradient_highlight(BLUE, YELLOW) - q_and_a.scale_to_fit_width(SPACE_WIDTH) + q_and_a.scale_to_fit_width(SPACE_X_RADIUS) q_and_a.to_edge(UP, buff = LARGE_BUFF) eater = ImageMobject("eater", height = 3) diff --git a/old_projects/tattoo.py b/old_projects/tattoo.py index 60b43aa2..42ca4a48 100644 --- a/old_projects/tattoo.py +++ b/old_projects/tattoo.py @@ -336,7 +336,7 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): cot_group = self.get_line_brace_text("cot") tan_text = tan_group[-1] cot_text = cot_group[-1] - line = Line(UP, DOWN).scale(SPACE_HEIGHT) + line = Line(UP, DOWN).scale(SPACE_Y_RADIUS) line.rotate(self.theta_value) line.move_to(self.theta_group[-1]) line.set_stroke(width = 2) @@ -537,7 +537,7 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): frac2.next_to(frac1) frac2[-2].highlight(YELLOW) frac_group = VGroup(opp_over_hyp, frac1, frac2) - frac_group.scale_to_fit_width(SPACE_WIDTH-1) + frac_group.scale_to_fit_width(SPACE_X_RADIUS-1) frac_group.next_to(ORIGIN, RIGHT).to_edge(UP) question = TextMobject("Why is this $\\theta$?") diff --git a/old_projects/tau_poem.py b/old_projects/tau_poem.py index 22dbbaca..523a9f70 100644 --- a/old_projects/tau_poem.py +++ b/old_projects/tau_poem.py @@ -158,7 +158,7 @@ class TauPoem(Scene): def first_word_to_last_digit(self): if self.line_num == 19: - shift_val = SPACE_HEIGHT*DOWN + shift_val = SPACE_Y_RADIUS*DOWN self.new_digit.shift(shift_val) self.play(ApplyMethod( self.first_digits.shift, shift_val, run_time = 2.0 @@ -359,9 +359,9 @@ class TauPoem(Scene): f_copy = deepcopy(formulae) for mob, count in zip(f_copy, it.count()): if count%3 == 0: - mob.to_edge(LEFT).shift(RIGHT*(SPACE_WIDTH-1)) + mob.to_edge(LEFT).shift(RIGHT*(SPACE_X_RADIUS-1)) else: - mob.shift(2*SPACE_WIDTH*RIGHT) + mob.shift(2*SPACE_X_RADIUS*RIGHT) self.play(*[ Transform(*mobs, run_time = 2.0) for mobs in zip(formulae, f_copy) @@ -369,9 +369,9 @@ class TauPoem(Scene): def line12(self): interval_size = 0.5 - axes_center = SPACE_WIDTH*LEFT/2 - grid_center = SPACE_WIDTH*RIGHT/2 - radius = SPACE_WIDTH / 2.0 + axes_center = SPACE_X_RADIUS*LEFT/2 + grid_center = SPACE_X_RADIUS*RIGHT/2 + radius = SPACE_X_RADIUS / 2.0 axes = Axes( radius = radius, interval_size = interval_size diff --git a/old_projects/three_dimensions.py b/old_projects/three_dimensions.py index c41302f5..ad06c362 100644 --- a/old_projects/three_dimensions.py +++ b/old_projects/three_dimensions.py @@ -8,7 +8,7 @@ from helpers import * class Stars(Mobject1D): CONFIG = { "stroke_width" : 1, - "radius" : SPACE_WIDTH, + "radius" : SPACE_X_RADIUS, "num_points" : 1000, } def generate_points(self): diff --git a/old_projects/triangle_of_power/triangle.py b/old_projects/triangle_of_power/triangle.py index 42d19266..6ca3955f 100644 --- a/old_projects/triangle_of_power/triangle.py +++ b/old_projects/triangle_of_power/triangle.py @@ -778,7 +778,7 @@ class TowerExponentFrame(Scene): $7{,}625{,}597{,}484{,}987$. But with the triangle of power, the difference is crystal clear: """) - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) words.to_edge(UP) top1 = TOP(TOP(3, 3), 3) top2 = TOP(3, (TOP(3, 3))) diff --git a/old_projects/triples.py b/old_projects/triples.py index 82d055dc..2617b166 100644 --- a/old_projects/triples.py +++ b/old_projects/triples.py @@ -210,7 +210,7 @@ class CompareToFermatsLastTheorem(TeacherStudentsScene): class WritePythagoreanTriple(Scene): def construct(self): words = TextMobject("``Pythagorean triple''") - words.scale_to_fit_width(2*SPACE_WIDTH - LARGE_BUFF) + words.scale_to_fit_width(2*SPACE_X_RADIUS - LARGE_BUFF) words.to_corner(DOWN+LEFT) self.play(Write(words)) self.wait(2) @@ -252,8 +252,8 @@ class ShowManyTriples(Scene): title.target.scale(0.5) title.target.move_to( - (-SPACE_WIDTH + MED_LARGE_BUFF + 2.7*(i//8))*RIGHT + \ - (SPACE_HEIGHT - MED_LARGE_BUFF - (i%8))*UP, + (-SPACE_X_RADIUS + MED_LARGE_BUFF + 2.7*(i//8))*RIGHT + \ + (SPACE_Y_RADIUS - MED_LARGE_BUFF - (i%8))*UP, UP+LEFT ) @@ -328,7 +328,7 @@ class BabylonianTablets(Scene): triple = TexMobject(tex) triples.add(triple) triples.arrange_submobjects(DOWN, aligned_edge = LEFT) - triples.scale_to_fit_height(2*SPACE_HEIGHT - LARGE_BUFF) + triples.scale_to_fit_height(2*SPACE_Y_RADIUS - LARGE_BUFF) triples.to_edge(RIGHT) self.add(title) @@ -960,10 +960,10 @@ class ReframeOnLattice(PiCreatureScene): def get_all_plane_dots(self): x_min, y_min = map(int, self.plane.point_to_coords( - SPACE_WIDTH*LEFT + SPACE_HEIGHT*DOWN + SPACE_X_RADIUS*LEFT + SPACE_Y_RADIUS*DOWN )) x_max, y_max = map(int, self.plane.point_to_coords( - SPACE_WIDTH*RIGHT + SPACE_HEIGHT*UP + SPACE_X_RADIUS*RIGHT + SPACE_Y_RADIUS*UP )) result = VGroup(*[ Dot( @@ -1495,7 +1495,7 @@ class WriteGeneralFormula(GeneralExample): def show_uv_to_triples(self): rect = self.corner_rect.copy() - rect.stretch_to_fit_height(2*SPACE_HEIGHT) + rect.stretch_to_fit_height(2*SPACE_Y_RADIUS) rect.move_to(self.corner_rect.get_bottom(), UP) h_line = Line(rect.get_left(), rect.get_right()) @@ -1572,8 +1572,8 @@ class VisualizeZSquared(Scene): self.show_more_triangles() def add_plane(self): - width = (SPACE_WIDTH+abs(self.plane_center[0]))/self.final_unit_size - height = (SPACE_HEIGHT+abs(self.plane_center[1]))/self.final_unit_size + width = (SPACE_X_RADIUS+abs(self.plane_center[0]))/self.final_unit_size + height = (SPACE_Y_RADIUS+abs(self.plane_center[1]))/self.final_unit_size background_plane = ComplexPlane( x_radius = width, y_radius = height, @@ -1698,7 +1698,7 @@ class VisualizeZSquared(Scene): def draw_dots(self): min_corner, max_corner = [ self.background_plane.point_to_coords( - u*SPACE_WIDTH*RIGHT + u*SPACE_HEIGHT*UP + u*SPACE_X_RADIUS*RIGHT + u*SPACE_Y_RADIUS*UP ) for u in -1, 1 ] @@ -1831,8 +1831,8 @@ class VisualizeZSquared(Scene): ### def get_color_grid(self): - width = (SPACE_WIDTH+abs(self.plane_center[0]))/self.initial_unit_size - height = (SPACE_HEIGHT+abs(self.plane_center[1]))/self.initial_unit_size + width = (SPACE_X_RADIUS+abs(self.plane_center[0]))/self.initial_unit_size + height = (SPACE_Y_RADIUS+abs(self.plane_center[1]))/self.initial_unit_size color_grid = ComplexPlane( x_radius = width, y_radius = int(height), @@ -2150,7 +2150,7 @@ class DrawRadialLines(PointsWeMiss): continue coord_strings.add(str(new_coords)) point = self.background_plane.coords_to_point(*new_coords) - if abs(point[0]) > SPACE_WIDTH or abs(point[1]) > SPACE_HEIGHT: + if abs(point[0]) > SPACE_X_RADIUS or abs(point[1]) > SPACE_Y_RADIUS: continue new_dot = Dot( point, color = GREEN, @@ -2159,7 +2159,7 @@ class DrawRadialLines(PointsWeMiss): new_dots.add(new_dot) line = Line(self.plane_center, dot.get_center()) line.scale( - 2*SPACE_WIDTH/line.get_length(), + 2*SPACE_X_RADIUS/line.get_length(), about_point = self.plane_center ) line.set_stroke(width = 1) @@ -2296,7 +2296,7 @@ class RationalPointsOnUnitCircle(DrawRadialLines): top_line = TexMobject( "a", "^2", "+", "b", "^2", "=", "c", "^2 \\phantom{1}" ) - top_line.shift(SPACE_WIDTH*RIGHT/2) + top_line.shift(SPACE_X_RADIUS*RIGHT/2) top_line.to_corner(UP + LEFT) top_line.shift(RIGHT) top_rect = BackgroundRectangle(top_line) @@ -2498,7 +2498,7 @@ class ProjectPointsOntoUnitCircle(DrawRadialLines): def draw_infinitely_many_lines(self): lines = VGroup(*[ - Line(ORIGIN, 2*SPACE_WIDTH*vect) + Line(ORIGIN, 2*SPACE_X_RADIUS*vect) for vect in compass_directions(1000) ]) diff --git a/old_projects/uncertainty.py b/old_projects/uncertainty.py index 91b6b502..1637299c 100644 --- a/old_projects/uncertainty.py +++ b/old_projects/uncertainty.py @@ -608,7 +608,7 @@ class ShowPlan(PiCreatureScene): title = TextMobject("The plan") title.scale(1.5) title.to_edge(UP) - h_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + h_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) h_line.next_to(title, DOWN) self.add(title, h_line) @@ -805,7 +805,7 @@ class TwoCarsAtRedLight(Scene): ) car2.pi_creature.highlight(GREY_BROWN) car1.start_point = car1.get_corner(DOWN+RIGHT) - car1.shift(SPACE_WIDTH*LEFT) + car1.shift(SPACE_X_RADIUS*LEFT) #Pull up car self.add(cars) @@ -1088,7 +1088,7 @@ class VariousMusicalNotes(Scene): graph_update_anim, **kwargs ) - change_width_anim(SPACE_WIDTH).update(1) + change_width_anim(SPACE_X_RADIUS).update(1) graph_update_anim.update(0) phrases = [ @@ -1102,7 +1102,7 @@ class VariousMusicalNotes(Scene): #Show graphs and phrases - widths = [SPACE_WIDTH, 1, 0.2] + widths = [SPACE_X_RADIUS, 1, 0.2] for width, phrase in zip(widths, phrases): brace = Brace(Line(LEFT, RIGHT), UP) brace.stretch(width, 0) @@ -1152,8 +1152,8 @@ class VariousMusicalNotes(Scene): long_graph = FunctionGraph( lambda x : 0.5*np.sin(freq*x), - x_min = -2*SPACE_WIDTH, - x_max = 2*SPACE_WIDTH, + x_min = -2*SPACE_X_RADIUS, + x_max = 2*SPACE_X_RADIUS, num_anchor_points = 1000 ) long_graph.highlight(BLUE) @@ -1471,7 +1471,7 @@ class CenterOfMassDescription(FourierRecapScene): circle_plane = self.get_circle_plane() circle_plane.save_state() circle_plane.generate_target() - circle_plane.target.scale_to_fit_height(2*SPACE_HEIGHT) + circle_plane.target.scale_to_fit_height(2*SPACE_Y_RADIUS) circle_plane.target.center() circle_plane.target.axes.set_stroke(width = 2) circle_plane.target.main_lines.set_stroke(width = 2) @@ -1728,7 +1728,7 @@ class FocusRectangleInsert(FourierRecapScene): self.setup_axes() self.clear() point = self.frequency_axes.coords_to_point(5, 0.25) - rect = ScreenRectangle(height = 2.1*SPACE_HEIGHT) + rect = ScreenRectangle(height = 2.1*SPACE_Y_RADIUS) rect.set_stroke(YELLOW, 2) self.add(rect) self.wait() @@ -2381,7 +2381,7 @@ class RadarOperatorUncertainty(Scene): echo_object = Square() echo_object.move_to(dish) - echo_object.shift(SPACE_WIDTH*RIGHT) + echo_object.shift(SPACE_X_RADIUS*RIGHT) pulse = RadarPulse(dish, echo_object, speed = 6) plane = Plane().scale(0.5) @@ -2994,7 +2994,7 @@ class IntroduceDeBroglie(Scene): numbers_with_elongated_ticks = range(1900, 1941, 10), color = BLUE_D ) - time_line.stretch_to_fit_width(2*SPACE_WIDTH - picture.get_width() - 2) + time_line.stretch_to_fit_width(2*SPACE_X_RADIUS - picture.get_width() - 2) time_line.add_numbers(*time_line.numbers_with_elongated_ticks) time_line.next_to(picture, RIGHT, MED_LARGE_BUFF, DOWN) @@ -3182,7 +3182,7 @@ class ShowMomentumFormula(IntroduceDeBroglie, TeacherStudentsScene): VGroup(xi, xi_words, added_xi_words, xi_arrow).highlight(self.xi_color) axes = Axes( - x_min = 0, x_max = 2*SPACE_WIDTH, + x_min = 0, x_max = 2*SPACE_X_RADIUS, y_min = -1, y_max = 1, ) axes.center().to_edge(UP, buff = -0.5) @@ -3386,7 +3386,7 @@ class SortOfDopplerEffect(PiCreatureScene): } def setup(self): PiCreatureScene.setup(self) - rect = self.screen_rect = ScreenRectangle(height = 2*SPACE_HEIGHT) + rect = self.screen_rect = ScreenRectangle(height = 2*SPACE_Y_RADIUS) rect.set_stroke(width = 0) self.camera = MovingCamera( rect, **self.camera_config @@ -3410,8 +3410,8 @@ class SortOfDopplerEffect(PiCreatureScene): func = lambda x : 0.5*np.cos(omega*t - k*x) graph = FunctionGraph( func, - x_min = -5*SPACE_WIDTH, - x_max = SPACE_WIDTH, + x_min = -5*SPACE_X_RADIUS, + x_max = SPACE_X_RADIUS, color = color, ) return VGroup(graph, *[ @@ -3420,7 +3420,7 @@ class SortOfDopplerEffect(PiCreatureScene): color = color ) for x in np.arange( - -4*SPACE_WIDTH, SPACE_WIDTH, + -4*SPACE_X_RADIUS, SPACE_X_RADIUS, self.arrow_spacing ) ]) @@ -3475,7 +3475,7 @@ class SortOfDopplerEffect(PiCreatureScene): ), ) self.play( - screen_rect.move_to, rect.get_right()+SPACE_WIDTH*LEFT, + screen_rect.move_to, rect.get_right()+SPACE_X_RADIUS*LEFT, k_tracker.shift, 2*LEFT, ) @@ -3514,7 +3514,7 @@ class SortOfDopplerEffect(PiCreatureScene): class HangingWeightsScene(MovingCameraScene): CONFIG = { "frequency" : 0.5, - "ceiling_radius" : 3*SPACE_WIDTH, + "ceiling_radius" : 3*SPACE_X_RADIUS, "n_springs" : 72, "amplitude" : 0.6, "spring_radius" : 0.15, @@ -3669,7 +3669,7 @@ class HangingWeightsScene(MovingCameraScene): self.einstein = einstein def moving_reference_frame(self): - rect = ScreenRectangle(height = 2.1*SPACE_HEIGHT) + rect = ScreenRectangle(height = 2.1*SPACE_Y_RADIUS) rect_movement = AmbientMovement(rect, direction = LEFT, rate = 2) camera_frame = self.camera_frame @@ -3681,7 +3681,7 @@ class HangingWeightsScene(MovingCameraScene): FadeOut(self.einstein), ) self.play(camera_frame.scale, 3, {"about_point" : 2*UP}) - self.play(rect.shift, 2*SPACE_WIDTH*RIGHT, path_arc = -TAU/2) + self.play(rect.shift, 2*SPACE_X_RADIUS*RIGHT, path_arc = -TAU/2) self.add(rect_movement) self.wait(3) @@ -3929,7 +3929,7 @@ class FourierTransformOfWaveFunction(Scene): sinusoid = axes.get_graph( lambda x : 0.5*np.cos(TAU*x), - x_min = -SPACE_WIDTH, x_max = 3*SPACE_WIDTH, + x_min = -SPACE_X_RADIUS, x_max = 3*SPACE_X_RADIUS, ) sinusoid.to_edge(UP, buff = SMALL_BUFF) @@ -4390,7 +4390,7 @@ class ThinkOfHeisenbergUncertainty(PiCreatureScene): dot_gdw = dot_cloud.gaussian_distribution_wrapper dot_gdw.scale_to_fit_width(1) dot_gdw.rotate(TAU/8) - dot_gdw.move_to(SPACE_WIDTH*RIGHT/2), + dot_gdw.move_to(SPACE_X_RADIUS*RIGHT/2), vector_cloud = ProbabalisticVectorCloud( center_func = dot_gdw.get_center @@ -4457,7 +4457,7 @@ class ThinkOfHeisenbergUncertainty(PiCreatureScene): self.play( ApplyMethod( VGroup(dot_gdw, vector_gdw ).shift, - SPACE_WIDTH*RIGHT, + SPACE_X_RADIUS*RIGHT, rate_func = running_start ) ) @@ -4652,7 +4652,7 @@ class PuzzleStatement(Scene): to determine who we send. Can we make sure we don't send the weakest person? """, alignment = "") - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) words.next_to(group, DOWN, LARGE_BUFF) self.play(LaggedStart(FadeIn, words, run_time = 5, lag_ratio = 0.2)) self.wait(2) diff --git a/old_projects/waves.py b/old_projects/waves.py index 104c6909..a6541ccc 100644 --- a/old_projects/waves.py +++ b/old_projects/waves.py @@ -110,8 +110,8 @@ class EMWave(ContinualAnimationGroup): "frequency" : 0.25, "n_vectors" : 40, "propogation_direction" : RIGHT, - "start_point" : SPACE_WIDTH*LEFT + DOWN + OUT, - "length" : 2*SPACE_WIDTH, + "start_point" : SPACE_X_RADIUS*LEFT + DOWN + OUT, + "length" : 2*SPACE_X_RADIUS, "amplitude" : 1, "rotation" : 0, "A_vect" : [0, 0, 1], @@ -194,7 +194,7 @@ class WavePacket(Animation): CONFIG = { "EMWave_config" : { "wave_number" : 0, - "start_point" : SPACE_WIDTH*LEFT, + "start_point" : SPACE_X_RADIUS*LEFT, "phi_vect" : np.ones(3)*np.pi/4, }, "em_wave" : None, @@ -203,7 +203,7 @@ class WavePacket(Animation): "packet_width" : 6, "include_E_vects" : True, "include_M_vects" : True, - "filter_distance" : SPACE_WIDTH, + "filter_distance" : SPACE_X_RADIUS, "get_filtered" : False, "remover" : True, "width" : 2*np.pi, @@ -308,7 +308,7 @@ class FilterScene(ThreeDScene): "filter_x_coordinates" : [0], "pol_filter_configs" : [{}], "EMWave_config" : { - "start_point" : SPACE_WIDTH*LEFT + DOWN+OUT + "start_point" : SPACE_X_RADIUS*LEFT + DOWN+OUT }, "axes_config" : {}, "start_phi" : 0.8*np.pi/2, @@ -340,7 +340,7 @@ class FilterScene(ThreeDScene): def get_filter_absorption_animation(self, pol_filter, photon): x = pol_filter.get_center()[0] - alpha = (x + SPACE_WIDTH) / (2*SPACE_WIDTH) + alpha = (x + SPACE_X_RADIUS) / (2*SPACE_X_RADIUS) return ApplyMethod( pol_filter.set_fill, RED, run_time = photon.run_time, @@ -379,7 +379,7 @@ class DirectionOfPolarizationScene(FilterScene): def setup_rectangles(self): rect1 = Rectangle( height = 2*self.em_wave.amplitude, - width = SPACE_WIDTH + 0.25, + width = SPACE_X_RADIUS + 0.25, stroke_color = BLUE, fill_color = BLUE, fill_opacity = 0.2, @@ -502,7 +502,7 @@ class Goal(PiCreatureScene): goal = TextMobject("Goal: ") goal.highlight(YELLOW) - goal.shift(SPACE_WIDTH*LEFT/2 + UP) + goal.shift(SPACE_X_RADIUS*LEFT/2 + UP) weirdness = TextMobject("Eye-catching quantum weirdness") weirdness.next_to(goal, RIGHT) cross = Cross(weirdness) @@ -791,7 +791,7 @@ class IntroduceMagneticField(IntroduceElectricField, ThreeDScene): M_vect.shift(SMALL_BUFF*M_vect.get_vector()) particle.save_state() - particle.shift(2*SPACE_WIDTH*LEFT) + particle.shift(2*SPACE_X_RADIUS*LEFT) self.play( particle.restore, @@ -876,7 +876,7 @@ class CurlRelationBetweenFields(ThreeDScene): self.second_loop_in_E() def add_axes(self): - self.add(ThreeDAxes(x_axis_radius = SPACE_WIDTH)) + self.add(ThreeDAxes(x_axis_radius = SPACE_X_RADIUS)) def loop_in_E(self): E_vects = VGroup(*[ @@ -975,7 +975,7 @@ class WriteCurlEquations(Scene): ) eqs = VGroup(eq1, eq2) eqs.arrange_submobjects(DOWN, buff = LARGE_BUFF) - eqs.scale_to_fit_height(2*SPACE_HEIGHT - 1) + eqs.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) eqs.to_edge(LEFT) for eq in eqs: eq.highlight_by_tex_to_color_map({ @@ -1085,7 +1085,7 @@ class DirectWaveOutOfScreen(IntroduceEMWave): "EMWave_config" : { "requires_start_up" : False, "amplitude" : 2, - "start_point" : SPACE_WIDTH*LEFT, + "start_point" : SPACE_X_RADIUS*LEFT, "A_vect" : [0, 1, 0], "start_up_time" : 0, } @@ -1562,7 +1562,7 @@ class ChangeFromHorizontalToVerticallyPolarized(DirectionOfPolarizationScene): CONFIG = { "filter_x_coordinates" : [], "EMWave_config" : { - "start_point" : SPACE_WIDTH*LEFT, + "start_point" : SPACE_X_RADIUS*LEFT, "A_vect" : [0, 2, 0], } } @@ -1901,7 +1901,7 @@ class FromBracketFootnote(Scene): arg_separator = "" ) words.highlight_by_tex("ket", YELLOW) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) self.add(words) class Ay(Scene): @@ -1959,7 +1959,7 @@ class AlternateBasis(ShowTipToTailSum): new_plane = NumberPlane( x_unit_size = 2, y_unit_size = 2, - y_radius = SPACE_WIDTH, + y_radius = SPACE_X_RADIUS, secondary_line_ratio = 0, ) new_plane.add_coordinates() @@ -2020,14 +2020,14 @@ class AlternateBasis(ShowTipToTailSum): class WriteBasis(Scene): def construct(self): words = TextMobject("Choice of ``basis''") - words.scale_to_fit_width(2*SPACE_WIDTH-1) + words.scale_to_fit_width(2*SPACE_X_RADIUS-1) self.play(Write(words)) self.wait() class ShowPolarizingFilter(DirectionOfPolarizationScene): CONFIG = { "EMWave_config" : { - "start_point" : SPACE_WIDTH*LEFT, + "start_point" : SPACE_X_RADIUS*LEFT, }, "apply_filter" : True, } @@ -2205,7 +2205,7 @@ class ShowPolarizingFilter(DirectionOfPolarizationScene): class NamePolarizingFilter(Scene): def construct(self): words = TextMobject("Polarizing filter") - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) self.play(Write(words)) self.wait() @@ -2214,7 +2214,7 @@ class EnergyOfWavesWavePortion(DirectWaveOutOfScreen): "EMWave_config" : { "A_vect" : [0, 1, 1], "amplitude" : 4, - "start_point" : SPACE_WIDTH*LEFT + 2*DOWN, + "start_point" : SPACE_X_RADIUS*LEFT + 2*DOWN, } } def construct(self): @@ -2435,7 +2435,7 @@ class DescribePhoton(ThreeDScene): self.set_camera_position(phi = 0.8*np.pi/2, theta = -np.pi/4) em_wave = EMWave( - start_point = SPACE_WIDTH*LEFT, + start_point = SPACE_X_RADIUS*LEFT, A_vect = [0, 1, 1], wave_number = 0, amplitude = 3, @@ -2521,7 +2521,7 @@ class DescribePhoton(ThreeDScene): secondary_color = DARK_GREY, x_unit_size = 2, y_unit_size = 2, - y_radius = SPACE_WIDTH, + y_radius = SPACE_X_RADIUS, ) plane.add_coordinates(x_vals = range(-3, 4), y_vals = []) plane.rotate(np.pi/2, RIGHT) @@ -2902,14 +2902,14 @@ class SeeCommentInDescription(Scene): vs. double-headed arrows \\end{flushleft} """) - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_corner(DOWN+LEFT) self.add(words) class SeeCommentInDescriptionAgain(Scene): def construct(self): words = TextMobject("$^*$Again, see description") - words.scale_to_fit_width(2*SPACE_WIDTH - 1) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 1) words.to_corner(DOWN+LEFT) self.add(words) @@ -2924,7 +2924,7 @@ class ShootPhotonThroughFilter(DirectionOfPolarizationScene): "EMWave_config" : { "wave_number" : 0, "A_vect" : [0, 1, 1], - "start_point" : SPACE_WIDTH*LEFT, + "start_point" : SPACE_X_RADIUS*LEFT, "amplitude" : np.sqrt(2), }, "pol_filter_configs" : [{ @@ -3450,7 +3450,7 @@ class PhotonAtSlightAngle(ThreeFilters): "EMWave_config" : { "wave_number" : 0, "A_vect" : [0, np.sin(np.pi/8), np.cos(np.pi/8)], - "start_point" : SPACE_WIDTH*LEFT, + "start_point" : SPACE_X_RADIUS*LEFT, "amplitude" : 2, }, "axes_config" : { @@ -3853,7 +3853,7 @@ class PhotonAtSlightAngle(ThreeFilters): def get_blocked_photon(self, **kwargs): return self.get_photon( - filter_distance = SPACE_WIDTH + 3, + filter_distance = SPACE_X_RADIUS + 3, get_filtered = True, **kwargs ) @@ -4202,7 +4202,7 @@ class ClockwisePhotonInsert(Scene): ) eq.highlight(BLUE) VGroup(*it.chain(eq[:4], eq[-5:])).highlight(WHITE) - eq.scale_to_fit_height(2*SPACE_HEIGHT - 1) + eq.scale_to_fit_height(2*SPACE_Y_RADIUS - 1) eq.to_edge(LEFT) self.add(eq) @@ -4304,7 +4304,7 @@ class Footnote(Scene): from quantum mechanics conventions. \\end{flushleft} """) - words.scale_to_fit_width(2*SPACE_WIDTH - 2) + words.scale_to_fit_width(2*SPACE_X_RADIUS - 2) self.add(words) diff --git a/old_projects/zeta.py b/old_projects/zeta.py index ef8f7f1c..95d9479e 100644 --- a/old_projects/zeta.py +++ b/old_projects/zeta.py @@ -30,7 +30,7 @@ mpmath.mp.dps = 7 def zeta(z): - max_norm = SPACE_WIDTH + max_norm = SPACE_X_RADIUS try: return np.complex(mpmath.zeta(z)) except: @@ -51,7 +51,7 @@ class ZetaTransformationScene(ComplexTransformationScene): "run_time" : 5, }, "x_min" : 1, - "x_max" : int(SPACE_WIDTH+2), + "x_max" : int(SPACE_X_RADIUS+2), "extra_lines_x_min" : -2, "extra_lines_x_max" : 4, "extra_lines_y_min" : -2, @@ -1027,7 +1027,7 @@ class FromRealToComplex(ComplexTransformationScene): def transition_to_spiril_sum(self): zeta = self.get_zeta_definition("2+i", "1.15 - 0.44i") - zeta.scale_to_fit_width(2*SPACE_WIDTH-1) + zeta.scale_to_fit_width(2*SPACE_X_RADIUS-1) zeta.to_corner(UP+LEFT) lines, output_dot = self.get_sum_lines(complex(2, 1)) @@ -1076,16 +1076,16 @@ class FromRealToComplex(ComplexTransformationScene): def show_domain_of_convergence(self, opacity = 0.2): domain = Rectangle( - width = SPACE_WIDTH-2, - height = 2*SPACE_HEIGHT, + width = SPACE_X_RADIUS-2, + height = 2*SPACE_Y_RADIUS, stroke_width = 0, fill_color = YELLOW, fill_opacity = opacity, ) domain.to_edge(RIGHT, buff = 0) anti_domain = Rectangle( - width = SPACE_WIDTH+2, - height = 2*SPACE_HEIGHT, + width = SPACE_X_RADIUS+2, + height = 2*SPACE_Y_RADIUS, stroke_width = 0, fill_color = RED, fill_opacity = opacity, @@ -1217,7 +1217,7 @@ class TerritoryOfExponents(ComplexTransformationScene): familiar_territory.highlight(YELLOW) familiar_territory.next_to(ORIGIN, UP+RIGHT) familiar_territory.shift(2*UP) - real_line = Line(LEFT, RIGHT).scale(SPACE_WIDTH) + real_line = Line(LEFT, RIGHT).scale(SPACE_X_RADIUS) real_line.highlight(YELLOW) arrow1 = Arrow(familiar_territory.get_bottom(), real_line.get_left()) arrow2 = Arrow(familiar_territory.get_bottom(), real_line.get_right()) @@ -1226,8 +1226,8 @@ class TerritoryOfExponents(ComplexTransformationScene): extended_realm = TextMobject("Extended realm") extended_realm.move_to(familiar_territory) full_plane = Rectangle( - width = 2*SPACE_WIDTH, - height = 2*SPACE_HEIGHT, + width = 2*SPACE_X_RADIUS, + height = 2*SPACE_Y_RADIUS, fill_color = YELLOW, fill_opacity = 0.3 ) @@ -1306,9 +1306,9 @@ class ComplexExponentiation(Scene): self.imag_exponent = imag_part def add_on_planes(self): - left_plane = NumberPlane(x_radius = (SPACE_WIDTH-1)/2) + left_plane = NumberPlane(x_radius = (SPACE_X_RADIUS-1)/2) left_plane.to_edge(LEFT, buff = 0) - imag_line = Line(DOWN, UP).scale(SPACE_HEIGHT) + imag_line = Line(DOWN, UP).scale(SPACE_Y_RADIUS) imag_line.highlight(YELLOW).fade(0.3) imag_line.move_to(left_plane.get_center()) left_plane.add(imag_line) @@ -1317,7 +1317,7 @@ class ComplexExponentiation(Scene): left_title.highlight(YELLOW) left_title.next_to(left_plane.get_top(), DOWN) - right_plane = NumberPlane(x_radius = (SPACE_WIDTH-1)/2) + right_plane = NumberPlane(x_radius = (SPACE_X_RADIUS-1)/2) right_plane.to_edge(RIGHT, buff = 0) unit_circle = Circle() unit_circle.highlight(MAROON_B).fade(0.3) @@ -1709,8 +1709,8 @@ class VisualizingSSquared(ComplexTransformationScene): self.plane.next_to(ORIGIN, UP, buff = 0.01) self.plane.add(self.plane.copy().rotate(np.pi, RIGHT)) self.plane.add( - Line(ORIGIN, SPACE_WIDTH*RIGHT, color = self.horiz_end_color), - Line(ORIGIN, SPACE_WIDTH*LEFT, color = self.horiz_end_color), + Line(ORIGIN, SPACE_X_RADIUS*RIGHT, color = self.horiz_end_color), + Line(ORIGIN, SPACE_X_RADIUS*LEFT, color = self.horiz_end_color), ) self.add(self.plane) @@ -1754,7 +1754,7 @@ class VisualizingSSquared(ComplexTransformationScene): class ShowZetaOnHalfPlane(ZetaTransformationScene): CONFIG = { "x_min" : 1, - "x_max" : int(SPACE_WIDTH+2), + "x_max" : int(SPACE_X_RADIUS+2), } def construct(self): self.add_title() @@ -1824,7 +1824,7 @@ class ShowZetaOnHalfPlane(ZetaTransformationScene): words.shift(LEFT+UP) line = Line(*map(self.z_to_point, [ - complex(np.euler_gamma, u*SPACE_HEIGHT) + complex(np.euler_gamma, u*SPACE_Y_RADIUS) for u in 1, -1 ])) line.highlight(YELLOW) @@ -1849,7 +1849,7 @@ class ShowZetaOnHalfPlane(ZetaTransformationScene): VGroup(*[ Line( vert_vect+RIGHT, - vert_vect+(SPACE_WIDTH+1)*horiz_vect + vert_vect+(SPACE_X_RADIUS+1)*horiz_vect ) for vert_vect in UP, DOWN ]) @@ -1976,7 +1976,7 @@ class ShowConditionalDefinition(Scene): class SquiggleOnExtensions(ZetaTransformationScene): CONFIG = { "x_min" : 1, - "x_max" : int(SPACE_WIDTH+2), + "x_max" : int(SPACE_X_RADIUS+2), } def construct(self): self.show_negative_one() @@ -2038,7 +2038,7 @@ class SquiggleOnExtensions(ZetaTransformationScene): ]) def mixed_scalar_func(point): x, y, z = point - scalar = 1 + (gamma-x)/(gamma+SPACE_WIDTH) + scalar = 1 + (gamma-x)/(gamma+SPACE_X_RADIUS) return np.array([ (scalar**2)*x, (scalar**3)*y, @@ -2046,7 +2046,7 @@ class SquiggleOnExtensions(ZetaTransformationScene): ]) def alt_mixed_scalar_func(point): x, y, z = point - scalar = 1 + (gamma-x)/(gamma+SPACE_WIDTH) + scalar = 1 + (gamma-x)/(gamma+SPACE_X_RADIUS) return np.array([ (scalar**5)*x, (scalar**2)*y, @@ -2668,7 +2668,7 @@ class ManyIntersectingLinesPostZeta(ManyIntersectingLinesPreZeta): class ManyIntersectingLinesPreSSquared(ManyIntersectingLinesPreZeta): CONFIG = { - "x_min" : -int(SPACE_WIDTH), + "x_min" : -int(SPACE_X_RADIUS), "apply_zeta" : False, "lines_center" : ORIGIN, "nudge_size" : 0.9, @@ -2854,7 +2854,7 @@ class DiscussZeros(ZetaTransformationScene): def show_critical_strip(self): strip = Rectangle( - height = 2*SPACE_HEIGHT, + height = 2*SPACE_Y_RADIUS, width = 1 ) strip.next_to(ORIGIN, RIGHT, buff = 0) @@ -2877,8 +2877,8 @@ class DiscussZeros(ZetaTransformationScene): ]) new_dots.highlight(YELLOW) critical_line = Line( - 0.5*RIGHT+SPACE_HEIGHT*DOWN, - 0.5*RIGHT+SPACE_HEIGHT*UP, + 0.5*RIGHT+SPACE_Y_RADIUS*DOWN, + 0.5*RIGHT+SPACE_Y_RADIUS*UP, color = YELLOW ) @@ -3004,15 +3004,15 @@ class HighlightCriticalLineAgain(DiscussZeros): self.add(title) strip = Rectangle( - height = 2*SPACE_HEIGHT, + height = 2*SPACE_Y_RADIUS, width = 1 ) strip.next_to(ORIGIN, RIGHT, buff = 0) strip.set_stroke(width = 0) strip.set_fill(YELLOW, opacity = 0.3) line = Line( - 0.5*RIGHT+SPACE_HEIGHT*UP, - 0.5*RIGHT+SPACE_HEIGHT*DOWN, + 0.5*RIGHT+SPACE_Y_RADIUS*UP, + 0.5*RIGHT+SPACE_Y_RADIUS*DOWN, color = YELLOW ) randy = Randolph().to_corner(DOWN+LEFT) @@ -3296,18 +3296,18 @@ class Thumbnail(ZetaTransformationScene): self.plane.set_stroke(width = 4) div_sum = TexMobject("-\\frac{1}{12} = ", "1+2+3+4+\\cdots") - div_sum.scale_to_fit_width(2*SPACE_WIDTH-1) + div_sum.scale_to_fit_width(2*SPACE_X_RADIUS-1) div_sum.to_edge(DOWN) div_sum.highlight(YELLOW) for mob in div_sum.submobjects: mob.add_to_back(BackgroundRectangle(mob)) zeta = TexMobject("\\zeta(s)") - zeta.scale_to_fit_height(SPACE_HEIGHT-1) + zeta.scale_to_fit_height(SPACE_Y_RADIUS-1) zeta.to_corner(UP+LEFT) million = TexMobject("\\$1{,}000{,}000") - million.scale_to_fit_width(SPACE_WIDTH+1) + million.scale_to_fit_width(SPACE_X_RADIUS+1) million.to_edge(UP+RIGHT) million.highlight(GREEN_B) million.add_background_rectangle() diff --git a/scene/moving_camera_scene.py b/scene/moving_camera_scene.py index 5cb9696d..da3d84b3 100644 --- a/scene/moving_camera_scene.py +++ b/scene/moving_camera_scene.py @@ -6,7 +6,7 @@ from topics.geometry import ScreenRectangle class MovingCameraScene(Scene): def setup(self): - self.camera_frame = ScreenRectangle(height = 2*SPACE_HEIGHT) + self.camera_frame = ScreenRectangle(height = 2*SPACE_Y_RADIUS) self.camera_frame.set_stroke(width = 0) self.camera = MovingCamera( self.camera_frame, **self.camera_config diff --git a/topics/characters.py b/topics/characters.py index 7bdb862d..c3c42ffc 100644 --- a/topics/characters.py +++ b/topics/characters.py @@ -704,7 +704,7 @@ class TeacherStudentsScene(PiCreatureScene): run_time = 2 ) - def zoom_in_on_thought_bubble(self, bubble = None, radius = SPACE_HEIGHT+SPACE_WIDTH): + def zoom_in_on_thought_bubble(self, bubble = None, radius = SPACE_Y_RADIUS+SPACE_X_RADIUS): if bubble is None: for pi in self.get_pi_creatures(): if hasattr(pi, "bubble") and isinstance(pi.bubble, ThoughtBubble): diff --git a/topics/combinatorics.py b/topics/combinatorics.py index 6d8f8286..71c1e746 100644 --- a/topics/combinatorics.py +++ b/topics/combinatorics.py @@ -6,7 +6,7 @@ from mobject.tex_mobject import TexMobject from scene import Scene -DEFAULT_COUNT_NUM_OFFSET = (SPACE_WIDTH - 1, SPACE_HEIGHT - 1, 0) +DEFAULT_COUNT_NUM_OFFSET = (SPACE_X_RADIUS - 1, SPACE_Y_RADIUS - 1, 0) DEFAULT_COUNT_RUN_TIME = 5.0 class CountingScene(Scene): @@ -87,8 +87,8 @@ class CountingScene(Scene): class PascalsTriangle(VMobject): CONFIG = { "nrows" : 7, - "height" : 2*SPACE_HEIGHT - 1, - "width" : 1.5*SPACE_WIDTH, + "height" : 2*SPACE_Y_RADIUS - 1, + "width" : 1.5*SPACE_X_RADIUS, "portion_to_fill" : 0.7 } def generate_points(self): diff --git a/topics/common_scenes.py b/topics/common_scenes.py index 8848a125..00a88ea9 100644 --- a/topics/common_scenes.py +++ b/topics/common_scenes.py @@ -35,7 +35,7 @@ class OpeningQuote(Scene): self.play(Write(self.author, run_time = 3)) self.wait() - def get_quote(self, max_width = 2*SPACE_WIDTH-1): + def get_quote(self, max_width = 2*SPACE_X_RADIUS-1): text_mobject_kwargs = { "alignment" : "", "arg_separator" : self.quote_arg_separator, @@ -148,17 +148,17 @@ class PatreonEndScreen(PatreonThanks): def scroll_through_patrons(self): logo_box = Square(side_length = 2.5) logo_box.to_corner(DOWN+LEFT, buff = MED_LARGE_BUFF) - total_width = SPACE_WIDTH - logo_box.get_right()[0] + total_width = SPACE_X_RADIUS - logo_box.get_right()[0] black_rect = Rectangle( fill_color = BLACK, fill_opacity = 1, stroke_width = 0, - width = 2*SPACE_WIDTH, - height = 1.1*SPACE_HEIGHT + width = 2*SPACE_X_RADIUS, + height = 1.1*SPACE_Y_RADIUS ) black_rect.to_edge(UP, buff = 0) - line = DashedLine(SPACE_WIDTH*LEFT, SPACE_WIDTH*RIGHT) + line = DashedLine(SPACE_X_RADIUS*LEFT, SPACE_X_RADIUS*RIGHT) line.move_to(black_rect, DOWN) line.shift(SMALL_BUFF*SMALL_BUFF*DOWN) self.add(line) @@ -183,7 +183,7 @@ class PatreonEndScreen(PatreonThanks): columns.to_edge(RIGHT) self.play( - columns.next_to, SPACE_HEIGHT*DOWN, UP, LARGE_BUFF, + columns.next_to, SPACE_Y_RADIUS*DOWN, UP, LARGE_BUFF, columns.to_edge, RIGHT, Animation(black_rect), rate_func = None, diff --git a/topics/complex_numbers.py b/topics/complex_numbers.py index a7bace5c..41166197 100644 --- a/topics/complex_numbers.py +++ b/topics/complex_numbers.py @@ -231,11 +231,11 @@ class ComplexPlane(NumberPlane): "color" : self.color, "density" : self.density, } - for radius in np.arange(circle_freq, SPACE_WIDTH, circle_freq): + for radius in np.arange(circle_freq, SPACE_X_RADIUS, circle_freq): self.add(Circle(radius = radius, **config)) for angle in np.arange(0, 2*np.pi, angle_freq): end_point = np.cos(angle)*RIGHT + np.sin(angle)*UP - end_point *= SPACE_WIDTH + end_point *= SPACE_X_RADIUS self.add(Line(ORIGIN, end_point, **config)) return self diff --git a/topics/counting.py b/topics/counting.py index 671505c6..e86142b1 100644 --- a/topics/counting.py +++ b/topics/counting.py @@ -14,7 +14,7 @@ from scene import Scene class CountingScene(Scene): CONFIG = { "digit_place_colors" : [YELLOW, MAROON_B, RED, GREEN, BLUE, PURPLE_D], - "counting_dot_starting_position" : (SPACE_WIDTH-1)*RIGHT + (SPACE_HEIGHT-1)*UP, + "counting_dot_starting_position" : (SPACE_X_RADIUS-1)*RIGHT + (SPACE_Y_RADIUS-1)*UP, "count_dot_starting_radius" : 0.5, "dot_configuration_height" : 2, "ones_configuration_location" : UP+2*RIGHT, diff --git a/topics/functions.py b/topics/functions.py index 27bffb69..c730f28c 100644 --- a/topics/functions.py +++ b/topics/functions.py @@ -27,8 +27,8 @@ class ParametricFunction(VMobject): class FunctionGraph(ParametricFunction): CONFIG = { "color" : YELLOW, - "x_min" : -SPACE_WIDTH, - "x_max" : SPACE_WIDTH, + "x_min" : -SPACE_X_RADIUS, + "x_max" : SPACE_X_RADIUS, } def __init__(self, function, **kwargs): digest_config(self, kwargs) diff --git a/topics/geometry.py b/topics/geometry.py index 00475e8d..e04603cd 100644 --- a/topics/geometry.py +++ b/topics/geometry.py @@ -721,7 +721,7 @@ class ScreenRectangle(Rectangle): class FullScreenRectangle(ScreenRectangle): CONFIG = { - "height" : 2*SPACE_HEIGHT, + "height" : 2*SPACE_Y_RADIUS, } class FullScreenFadeRectangle(FullScreenRectangle): diff --git a/topics/graph_scene.py b/topics/graph_scene.py index 22eac91e..91c84bf2 100644 --- a/topics/graph_scene.py +++ b/topics/graph_scene.py @@ -188,7 +188,7 @@ class GraphScene(Scene): #Search from right to left for x in np.linspace(self.x_max, self.x_min, 100): point = self.input_to_graph_point(x, graph) - if point[1] < SPACE_HEIGHT: + if point[1] < SPACE_Y_RADIUS: break x_val = x label.next_to( diff --git a/topics/graph_theory.py b/topics/graph_theory.py index bfa53c6d..dc1fb34e 100644 --- a/topics/graph_theory.py +++ b/topics/graph_theory.py @@ -308,7 +308,7 @@ class GraphScene(Scene): ]) def generate_treeified_spanning_tree(self): - bottom = -SPACE_HEIGHT + 1 + bottom = -SPACE_Y_RADIUS + 1 x_sep = 1 y_sep = 2 if not hasattr(self, "spanning_tree"): @@ -380,7 +380,7 @@ class GraphScene(Scene): Dot(point).highlight("green") for point in self.dual_points ] - self.dual_vertices[-1] = Circle().scale(SPACE_WIDTH + SPACE_HEIGHT) + self.dual_vertices[-1] = Circle().scale(SPACE_X_RADIUS + SPACE_Y_RADIUS) self.dual_points[-1] = point_at_infinity self.dual_edges = [] @@ -402,7 +402,7 @@ class GraphScene(Scene): self.points[pair[0]], self.points[pair[1]] ]) - new_point - new_point += SPACE_WIDTH*vect/np.linalg.norm(vect) + new_point += SPACE_X_RADIUS*vect/np.linalg.norm(vect) dual_point_pair[i] = new_point self.dual_edges.append( Line(*dual_point_pair).highlight() diff --git a/topics/matrix.py b/topics/matrix.py index 4ddbf1c3..cd81ee44 100644 --- a/topics/matrix.py +++ b/topics/matrix.py @@ -199,7 +199,7 @@ class NumericalMatrixMultiplication(Scene): equals = TexMobject("=") everything = VMobject(left, right, equals, result) everything.arrange_submobjects() - everything.scale_to_fit_width(2*SPACE_WIDTH-1) + everything.scale_to_fit_width(2*SPACE_X_RADIUS-1) self.add(everything) diff --git a/topics/number_line.py b/topics/number_line.py index 9aae1844..1a8efd39 100644 --- a/topics/number_line.py +++ b/topics/number_line.py @@ -10,8 +10,8 @@ from scene import Scene class NumberLine(VMobject): CONFIG = { "color" : BLUE, - "x_min" : -SPACE_WIDTH, - "x_max" : SPACE_WIDTH, + "x_min" : -SPACE_X_RADIUS, + "x_max" : SPACE_X_RADIUS, "unit_size" : 1, "tick_size" : 0.1, "tick_frequency" : 1, @@ -160,10 +160,10 @@ class Axes(VGroup): "x_axis_config" : {}, "y_axis_config" : {}, "z_axis_config" : {}, - "x_min" : -SPACE_WIDTH, - "x_max" : SPACE_WIDTH, - "y_min" : -SPACE_HEIGHT, - "y_max" : SPACE_HEIGHT, + "x_min" : -SPACE_X_RADIUS, + "x_max" : SPACE_X_RADIUS, + "y_min" : -SPACE_Y_RADIUS, + "y_max" : SPACE_Y_RADIUS, "z_min" : -3.5, "z_max" : 3.5, "z_normal" : DOWN, @@ -276,10 +276,10 @@ class NumberPlane(VMobject): } def generate_points(self): if self.x_radius is None: - center_to_edge = (SPACE_WIDTH + abs(self.center_point[0])) + center_to_edge = (SPACE_X_RADIUS + abs(self.center_point[0])) self.x_radius = center_to_edge / self.x_unit_size if self.y_radius is None: - center_to_edge = (SPACE_HEIGHT + abs(self.center_point[1])) + center_to_edge = (SPACE_Y_RADIUS + abs(self.center_point[1])) self.y_radius = center_to_edge / self.y_unit_size self.axes = VMobject() self.main_lines = VMobject() diff --git a/topics/objects.py b/topics/objects.py index 76a476b8..4323cc97 100644 --- a/topics/objects.py +++ b/topics/objects.py @@ -267,7 +267,7 @@ class PatreonLogo(SVGMobject): class VideoIcon(SVGMobject): CONFIG = { "file_name" : "video_icon", - "width" : 2*SPACE_WIDTH/12., + "width" : 2*SPACE_X_RADIUS/12., } def __init__(self, **kwargs): SVGMobject.__init__(self, **kwargs) @@ -286,7 +286,7 @@ class VideoSeries(VGroup): videos = [VideoIcon() for x in range(self.num_videos)] VGroup.__init__(self, *videos, **kwargs) self.arrange_submobjects() - self.scale_to_fit_width(2*SPACE_WIDTH-MED_LARGE_BUFF) + self.scale_to_fit_width(2*SPACE_X_RADIUS-MED_LARGE_BUFF) self.gradient_highlight(*self.gradient_colors) class Headphones(SVGMobject): diff --git a/topics/vector_space_scene.py b/topics/vector_space_scene.py index 9c41b62d..18e4772a 100644 --- a/topics/vector_space_scene.py +++ b/topics/vector_space_scene.py @@ -218,8 +218,8 @@ class VectorScene(Scene): vector = vector.get_end() - vector.get_start() elif len(vector) == 2: vector = np.append(np.array(vector), 0.0) - x_max = int(SPACE_WIDTH + abs(vector[0])) - y_max = int(SPACE_HEIGHT + abs(vector[1])) + x_max = int(SPACE_X_RADIUS + abs(vector[0])) + y_max = int(SPACE_Y_RADIUS + abs(vector[1])) dots = VMobject(*[ Dot(x*RIGHT + y*UP) for x in range(-x_max, x_max) @@ -242,8 +242,8 @@ class LinearTransformationScene(VectorScene): "include_background_plane" : True, "include_foreground_plane" : True, "foreground_plane_kwargs" : { - "x_radius" : 2*SPACE_WIDTH, - "y_radius" : 2*SPACE_HEIGHT, + "x_radius" : 2*SPACE_X_RADIUS, + "y_radius" : 2*SPACE_Y_RADIUS, "secondary_line_ratio" : 0 }, "background_plane_kwargs" : {