Some simple typo fixes

This commit is contained in:
Grant Sanderson
2017-05-31 16:07:37 -07:00
parent 2417c06398
commit 37a47b5d3d
11 changed files with 54 additions and 13 deletions

View File

@ -91,7 +91,7 @@ class CyclicReplace(Transform):
start = Group(*mobjects)
target = Group(*[
m1.copy().move_to(m2)
for m1, m2 in adjascent_pairs(start)
for m1, m2 in adjacent_pairs(start)
])
Transform.__init__(self, start, target, **kwargs)

View File

@ -1,8 +1,10 @@
import os
import numpy as np
DEFAULT_HEIGHT = 1080
DEFAULT_WIDTH = 1920
# DEFAULT_HEIGHT = 1080
# DEFAULT_WIDTH = 1920
DEFAULT_HEIGHT = 4*1920
DEFAULT_WIDTH = 4*1080
LOW_QUALITY_FRAME_DURATION = 1./20
MEDIUM_QUALITY_FRAME_DURATION = 1./30

View File

@ -202,7 +202,7 @@ def list_difference_update(l1, l2):
def all_elements_are_instances(iterable, Class):
return all(map(lambda e : isinstance(e, Class), iterable))
def adjascent_pairs(objects):
def adjacent_pairs(objects):
return zip(objects, list(objects[1:])+[objects[0]])
def complex_to_R3(complex_num):
@ -375,7 +375,7 @@ def counterclockwise_path():
################################################
def to_cammel_case(name):
def to_camel_case(name):
return "".join([
filter(
lambda c : c not in string.punctuation + string.whitespace, part
@ -407,7 +407,7 @@ def invert_image(image):
arr = (255 * np.ones(arr.shape)).astype(arr.dtype) - arr
return Image.fromarray(arr)
def streth_array_to_length(nparray, length):
def stretch_array_to_length(nparray, length):
curr_len = len(nparray)
if curr_len > length:
raise Warning("Trying to stretch array to a length shorter than its own")

View File

@ -23,7 +23,7 @@ class ImageMobject(PMobject):
def __init__(self, image_file, **kwargs):
digest_locals(self)
Mobject.__init__(self, **kwargs)
self.name = to_cammel_case(
self.name = to_camel_case(
os.path.split(image_file)[-1].split(".")[0]
)
possible_paths = [

View File

@ -115,7 +115,7 @@ class PMobject(Mobject):
def align_points_with_larger(self, larger_mobject):
assert(isinstance(larger_mobject, PMobject))
self.apply_over_attr_arrays(
lambda a : streth_array_to_length(
lambda a : stretch_array_to_length(
a, larger_mobject.get_num_points()
)
)

View File

@ -65,7 +65,7 @@ def region_from_line_boundary(*lines, **kwargs):
return reg
def region_from_polygon_vertices(*vertices, **kwargs):
return region_from_line_boundary(*adjascent_pairs(vertices), **kwargs)
return region_from_line_boundary(*adjacent_pairs(vertices), **kwargs)
def plane_partition(*lines, **kwargs):

View File

@ -41,7 +41,7 @@ class Jewel(VMobject):
compass_vects = list(compass_directions(self.num_equator_points))
if vect is IN:
compass_vects.reverse()
for vect_pair in adjascent_pairs(compass_vects):
for vect_pair in adjacent_pairs(compass_vects):
self.add(Polygon(vect, *vect_pair))
self.scale_to_fit_height(self.height)
self.rotate(-np.pi/2-np.pi/24, RIGHT)

View File

@ -155,7 +155,7 @@ class DrawSolutionsToZToTheNEqualsW(Scene):
Dot(point, color = BLUE_B, radius = 0.1)
for point in points
]
lines = [Line(*pair) for pair in adjascent_pairs(points)]
lines = [Line(*pair) for pair in adjacent_pairs(points)]
self.add(plane, circle, *dots+lines)
self.add(*plane.get_coordinate_labels())

View File

@ -293,7 +293,7 @@ class IHatAsEigenVector(ExampleTranformationScene):
]
lines = [
Line(v1.get_end(), v2.get_end(), color = YELLOW)
for v1, v2 in adjascent_pairs([self.i_hat]+targets)
for v1, v2 in adjacent_pairs([self.i_hat]+targets)
]
for target, line in zip(targets, lines):
self.play(

View File

@ -3070,6 +3070,45 @@ class Thumbnail(DrawRadialLines):
triples.next_to(rect.get_top(), DOWN)
self.add(rect, triples)
class Poster(DrawRadialLines):
CONFIG = {
"final_unit_size" : 0.1,
"plane_center" : ORIGIN,
}
def construct(self):
self.force_skipping()
self.add_plane()
self.add_transformed_color_grid()
self.color_grid.set_stroke(width = 5)
self.resize_plane()
self.add_dots()
self.create_lines()
self.show_single_line()
self.show_all_lines()
for dot_group in self.dots, self.new_dots:
for dot in dot_group.family_members_with_points():
dot.scale_in_place(0.5)
self.remove(self.coordinate_labels)
# rect = Rectangle(
# height = 4.3, width = 4.2,
# stroke_width = 3,
# stroke_color = WHITE,
# fill_color = BLACK,
# fill_opacity = 1,
# )
# rect.to_corner(UP+RIGHT, buff = 0.01)
# triples = VGroup(*map(TexMobject, [
# "3^2 + 4^2 = 5^2",
# "5^2 + 12^2 = 13^2",
# "8^2 + 15^2 = 17^2",
# "\\vdots"
# ]))
# triples.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF)
# triples.next_to(rect.get_top(), DOWN)
# self.add(rect, triples)

View File

@ -109,7 +109,7 @@ class ClosedLoopScene(Scene):
def add_connecting_lines(self, cyclic = False):
if cyclic:
pairs = adjascent_pairs(self.dots)
pairs = adjacent_pairs(self.dots)
else:
n_pairs = len(list(self.dots))/2
pairs = zip(self.dots[:n_pairs], self.dots[n_pairs:])