def _draw(self): GL.glLineWidth(self.line_width) GL.glColor3f(*self.color) for side in self.sides: draw_line(self.edges[side[0]], self.edges[side[1]]) GL.glLineWidth(1)
def draw_grid(self): y = WIDTH while (y < WINDOW_HEIGHT): draw_line((0, y), (WINDOW_WIDTH, y), self.grid_color, 2) y += WIDTH x = WIDTH while (x < WINDOW_WIDTH): draw_line((x, 0), (x, WINDOW_HEIGHT), self.grid_color, 2) x += WIDTH
def draw_border(self): draw_line((0, 0), (0, WINDOW_HEIGHT), self.border_color) draw_line((0, WINDOW_HEIGHT), (WINDOW_WIDTH, WINDOW_HEIGHT), self.border_color) draw_line((WINDOW_WIDTH, WINDOW_HEIGHT), (WINDOW_WIDTH, 0), self.border_color) draw_line((WINDOW_WIDTH, 0), (0, 0), self.border_color)
def draw_border(self): draw_line((0, 0), (0, CONSTS.WINDOW_HEIGHT), self.border_color, self.border_width) draw_line((0, CONSTS.WINDOW_HEIGHT), (CONSTS.WINDOW_WIDTH, CONSTS.WINDOW_HEIGHT), self.border_color, self.border_width) draw_line((CONSTS.WINDOW_WIDTH, CONSTS.WINDOW_HEIGHT), (CONSTS.WINDOW_WIDTH, 0), self.border_color, self.border_width) draw_line((CONSTS.WINDOW_WIDTH, 0), (0, 0), self.border_color, self.border_width)
def _draw(self): GL.glColor3f(*DARK_GREY) draw_line(*self.x_axis) draw_line(*self.y_axis) GL.glColor3f(*LIGHT_GREY) for line in chain(self.horizontal_grid, self.vertical_grid): draw_line(*line) GL.glColor3f(*DARK_GREY) GL.glLineWidth(2) draw_line(self.mark + (0, 5), self.mark + (0, -5)) GL.glLineWidth(1) draw_text(self.origin + (2, -10), "0") draw_text(self.mark + (2, -10), "20") draw_text(self.x_axis[1] + (2, -10), "X") draw_text(self.y_axis[1] + (2, -10), "Y")
def draw_bezier_curve(a: array, b: array, c: array, d: array): for p0, p1 in pairwise(get_bezier_curve(a, b, c, d)): draw_line(p0, p1)
def draw_point(point: array): draw_line(point + (-3, -3), point + (3, 3)) draw_line(point + (-3, 3), point + (3, -3))