Пример #1
0
 def construct(self):
     ShowRearrangementInBigSquare.construct(self)
     self.set_color_region(region_from_polygon_vertices(
         2 * (LEFT + UP), 2 * LEFT + DOWN, RIGHT + DOWN, RIGHT + 2 * UP),
                           color=B_COLOR)
     self.set_color_region(region_from_polygon_vertices(
         RIGHT + DOWN, RIGHT + 2 * DOWN, 2 * RIGHT + 2 * DOWN,
         2 * RIGHT + DOWN),
                           color=A_COLOR)
Пример #2
0
 def construct(self, *args):
     DrawAllThreeSquaresWithMoreTriangles.construct(self, *args)
     args_list = [(10, False)]
     color = Color("yellow")
     color.set_rgb(0.3 * np.array(color.get_rgb()))
     self.set_color_region(region_from_polygon_vertices((-3, 3), (-3, -2),
                                                        (4, -2), (4, 3)),
                           color=color)
Пример #3
0
 def set_color_triangles(self):
     for mob in self.submobjects:
         if isinstance(mob, Triangle):
             vertices = list(mob.get_vertices())
             for x in range(2):
                 self.set_color_region(
                     region_from_polygon_vertices(*vertices),
                     color=DARK_BLUE)
                 vertices.reverse()  #silly hack
Пример #4
0
 def construct(self, *args):
     AddParallelLines.construct(self, *args)
     triplets = [
         [(0, 2), (0, -1), (1, -1)],
         [(1, -1), (4, -1), (4, 0)],
         [(4, 0), (4, 3), (3, 3)],
         [(3, 3), (0, 3), (0, 2)],
     ]
     for triplet in triplets:
         self.set_color_region(region_from_polygon_vertices(*triplet),
                               color="DARK_BLUE")
Пример #5
0
 def construct(self, num, fill):
     DrawAllThreeSquares.construct(self)
     pairs = [((0, 2, 0), (1, -1, 0)), ((-3, -1, 0), (0, -2, 0)),
              ((4, -1, 0), (1, -2, 0)), ((0, -2, 0), (-3, -1, 0)),
              ((1, -2, 0), (4, -1, 0)), ((1, -1, 0), (4, 0, 0)),
              ((4, 0, 0), (3, 3, 0)), ((3, 3, 0), (0, 2, 0)),
              ((-3, 3, 0), (0, 2, 0)), ((0, 2, 0), (-3, 3, 0))]
     to_flip = [1, 3, 8, 9]
     for n in range(num):
         triangle = Triangle()
         if n in to_flip:
             triangle.rotate(np.pi, UP)
         self.add(triangle.place_hypotenuse_on(*pairs[n]))
         vertices = list(triangle.get_vertices())
         if n not in to_flip:
             vertices.reverse()
         if fill:
             self.set_color_region(region_from_polygon_vertices(*vertices),
                                   color=DARK_BLUE)
Пример #6
0
 def construct(self, *args):
     DrawCSquareWithAllTraingles.construct(self, *args)
     self.set_color_region(
         region_from_polygon_vertices(*c_square().center().get_vertices()),
         color=YELLOW)