def get_triangles_for_rectangle(self, min_x, max_x, min_y, max_y): """ Args: min_x: int max_x: int min_y: int max_y: int Returns: List(tri_image.triangle.Triangle) of length 2 """ if self.color_type == RGB: c = (0, 0, 0) else: c = 0 t1 = Triangle([min_x, min_y, min_x, max_y, max_x, max_y], c, 255) t1.set_color(self.source_image, self.color_type) t2 = Triangle([min_x, min_y, max_x, min_y, max_x, max_y], c, 255) t2.set_color(self.source_image, self.color_type) return [t1, t2]
from rectangle import Rectangle from triangle import Triangle import fun rectangle = Rectangle() rectangle.set_value(3, 4) rectangle.set_color('blue') print(rectangle.area()) print(rectangle.get_color()) triangle = Triangle() triangle.set_value(3, 4) triangle.set_color("yellow") print(triangle.area()) print(triangle.get_color()) print(fun.add(4, 7))
from rectangle import Rectangle from triangle import Triangle rect = Rectangle() tri = Triangle() rect.set_values(50, 40) tri.set_values(50, 40) rect.set_color('red') tri.set_color('blue') print(rect.area()) print(tri.area()) print(rect.get_color()) print(tri.get_color())
from rectangle import Rectangle from triangle import Triangle rect = Rectangle() tri = Triangle() rect.set_value(50, 50) tri.set_value(50, 50) tri.set_color('red') rect.set_color('black') print(tri.get_color()) print(rect.get_color()) print(rect.area()) print(tri.area())
from square import Square from triangle import Triangle s1 = Square() s1.set_value(8, 15) s1.set_color("Blue") print(s1.area(), s1.get_color()) t1 = Triangle() t1.set_value(5, 10) t1.set_color("Green") print(t1.area(), t1.get_color())
from triangle import Triangle from square import Square s1 = Square() s1.set_value(2, 3) s1.set_color("Green") print(s1.area(), s1.get_color()) s2 = Triangle() s2.set_value(5, 6) s2.set_color("Blue") print(s2.area(), s2.get_color())
from rectangle import Rectangle from triangle import Triangle rectangle = Rectangle() triangle = Triangle() rectangle.set_values(20, 20) triangle.set_values(20, 20) rectangle.set_color('red') triangle.set_color('blue') print(rectangle.area()) print(triangle.area()) print(rectangle.get_color()) print(triangle.get_color())
## We are using the module system from rectangle import Rectangle as Rec from triangle import Triangle as Tri rec = Rec() tri = Tri() rec.set_values(12, 10) tri.set_values(3, 10) rec.set_color("blue") tri.set_color("green") print(rec.area()) print(tri.area()) print(rec.get_color()) print(tri.get_color())
from rectangle import Rectangle from triangle import Triangle rect = Rectangle() rect.set_values(100, 200) rect.set_color('Red') print(rect.get_area()) print(rect.get_color()) tri = Triangle() tri.set_values(100, 200) tri.set_color('Green') print(tri.get_area()) print(tri.get_color())