コード例 #1
0
def vertical_line(x: float, start_y: float, end_y: float, color: tuple, line_width: float = 1):
    """
    Draws a vertical line. Good for saving space by cutting out a parameter.

    :param x: x-position of line's starting and ending points.
    :param start_y: y-position of line's starting point.
    :param end_y: y-position of line ending point.
    :param color: color, specified in a tuple of 3 or 4 bytes in RGB or RGBA format.
    :param line_width: width of the line in pixels.
    """
    line(x, start_y, x, end_y, color, line_width)
コード例 #2
0
def cl_horizontal_line(center_x: float, length: float, y: float, color: tuple, line_width: float = 1):
    """
    Draws a horizontal line by specifying its center point and length.

    :param center_x: x-position of line's center point.
    :param length: length of line.
    :param y: y-position of line's starting and ending points.
    :param color: color, specified in a tuple of 3 or 4 bytes in RGB or RGBA format.
    :param line_width: width of the line in pixels.
    """
    line(center_x - length / 2, y, center_x + length / 2, y, color, line_width)
コード例 #3
0
def horizontal_line(start_x: float,
                    end_x: float,
                    y: float,
                    color,
                    line_width: float = 1):
    """
    Draw a horizontal line. Good for saving space by cutting out a parameter.

    :param start_x: x position of line starting point.
    :param end_x: x position of line ending point.
    :param y: y position of line starting and ending points.
    :param color: color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
    :param line_width: Width of the line in pixels.
    """
    line(start_x, y, end_x, y, color, line_width)
コード例 #4
0
def cla_line(center_x: float, center_y: float, length: float, tilt_angle: float, color: tuple, line_width: float = 1):
    """
    Draws a line by specifying its center point, length, and angle tilted counterclockwise from its horizontal position.

    :param center_x: x-position of line's center point.
    :param center_y: y-position of line's center point.
    :param length: length of line.
    :param tilt_angle: angle tilted counterclockwise from its horizontal position.
    :param color: color, specified in a tuple of 3 or 4 bytes in RGB or RGBA format.
    :param line_width: width of the line in pixels.
    """
    length_x: float = length * np.cos(np.radians(tilt_angle))
    length_y: float = length * np.sin(np.radians(tilt_angle))
    line(center_x - length_x / 2, center_y - length_y / 2, center_x + length_x / 2, center_y + length_y / 2, color,
         line_width)