예제 #1
0
    def layer_sexy_triangles(self, parent, depth):
        if depth <= 0:
            return []

        direction = random.choice(list(Direction))
        color_side = color.get_random_contrasting_color(parent.color_layer)
        color_up = color.get_random_contrasting_color(parent.color_layer)

        if direction == Direction.Right:
            side_tri = parent.make_right_subtriangle(color_side)
        else:
            side_tri = parent.make_left_subtriangle(color_side)
        tri_up = parent.make_top_subtriangle(color_up)

        tri_side_subtris = self.layer_sexy_triangles(side_tri, depth - 1)
        tri_up_subtris = self.layer_sexy_triangles(tri_up, depth - 1)

        tri_side_list = [side_tri] + tri_side_subtris
        tri_up_list = [tri_up] + tri_up_subtris

        return tri_side_list + tri_up_list
예제 #2
0
    def layer_sexy_triangles(self, parent, depth):
        if depth <= 0:
            return []

        direction = random.choice(list(Direction))
        color_side = color.get_random_contrasting_color(parent.color_layer)
        color_up = color.get_random_contrasting_color(parent.color_layer)

        if direction == Direction.Right:
            side_tri = parent.make_right_subtriangle(color_side)
        else:
            side_tri = parent.make_left_subtriangle(color_side)
        tri_up = parent.make_top_subtriangle(color_up)

        tri_side_subtris = self.layer_sexy_triangles(side_tri, depth - 1)
        tri_up_subtris = self.layer_sexy_triangles(tri_up, depth - 1)

        tri_side_list = [side_tri] + tri_side_subtris
        tri_up_list = [tri_up] + tri_up_subtris

        return tri_side_list + tri_up_list
예제 #3
0
    def __init__(self, container_size, palet=color.ColorLayers, depth=6):
        super(RecursiveTriangles, self).__init__(container_size, palet, depth)

        _color = color.get_random_contrasting_color(color.ColorLayers.black,
                                                    palet)

        init_triangle = polygon.fit_triangle_into_rect(self.container_size,
                                                       _color)

        self.polygon_list = self.layer_sexy_triangles(init_triangle, depth)

        self.polygon_list = [init_triangle] + self.polygon_list
예제 #4
0
    def __init__(self, container_size, palet=color.ColorLayers, depth=6):
        super(RecursiveTriangles, self).__init__(container_size,
                                                 palet,
                                                 depth)

        _color = color.get_random_contrasting_color(color.ColorLayers.black,
                                                    palet)

        init_triangle = polygon.fit_triangle_into_rect(self.container_size,
                                                       _color)

        self.polygon_list = self.layer_sexy_triangles(init_triangle, depth)

        self.polygon_list = [init_triangle] + self.polygon_list