def triangle(rad=0.5):
    """Draw a triangle"""
    # half_height = math.sqrt(3) * side / 6
    # half_height = side / 2
    ctx = _state["ctx"]
    side = 3 * rad / math.sqrt(3)
    ctx.move_to(0, -rad / 2)
    ctx.line_to(-side / 2, -rad / 2)
    ctx.line_to(0, rad)
    ctx.line_to(side / 2, -rad / 2)
    ctx.close_path()
    ctx.fill()
def triangle ( rad = 0.5 ) : ctx = _state [ "ctx" ] side = 3 * rad / math . sqrt ( 3 ) ctx . move_to ( 0 , - rad / 2 ) ctx . line_to ( - side / 2 , - rad / 2 ) ctx . line_to ( 0 , rad ) ctx . line_to ( side / 2 , - rad / 2 ) ctx . close_path ( ) ctx . fill ( )
Draw a triangle