Ejemplo n.º 1
0
    def generate_points(self):
        for vect in IN, OUT, LEFT, RIGHT, UP, DOWN:
            face = Square(side_length=self.side_length)
            face.shift(self.side_length * OUT / 2.0)
            face.apply_function(lambda p: np.dot(p, z_to_vector(vect).T))

            self.add(face)
Ejemplo n.º 2
0
    def generate_points(self):
        for vect in IN, OUT, LEFT, RIGHT, UP, DOWN:
            face = Square(side_length=self.side_length)
            face.shift(self.side_length * OUT / 2.0)
            face.apply_function(lambda p: np.dot(p, z_to_vector(vect).T))

            self.add(face)
Ejemplo n.º 3
0
    def generate_points(self):
        for vect in IN, OUT, LEFT, RIGHT, UP, DOWN:
            face = Square(
                side_length=self.side_length,
                shade_in_3d=True,
            )
            face.make_jagged()
            face.flip()
            face.shift(self.side_length * OUT / 2.0)
            face.apply_matrix(z_to_vector(vect))

            self.add(face)
Ejemplo n.º 4
0
 def add_unit_square(self, color=YELLOW, opacity=0.3, animate=False):
     square = Square(color=color, side_length=1)
     square.shift(-square.get_corner(DOWN + LEFT))
     if animate:
         added_anims = map(Animation, self.moving_vectors)
         self.play(ShowCreation(square), *added_anims)
         self.play(square.set_fill, color, opacity, *added_anims)
     else:
         square.set_fill(color, opacity)
     self.add_transformable_mobject(square)
     self.bring_to_front(*self.moving_vectors)
     self.square = square
     return self