Beispiel #1
0
def make_hash_square3(tl, side, gap, a, pen_width, factor):

    centre = tl + Point(1, 1) * side / 2
    r = side * math.sqrt(2)
    gap = 2
    disp = 0
    while disp > -r / 2:
        disp -= gap
    unclipped_lines = []
    while disp < r / 2:
        line = []
        x = -r / 2
        a1 = 0
        x_inc = pen_width
        a_inc = math.pi * 2 * (x_inc / gap) * factor
        while x < r / 2:
            line.append(centre + Point(x, disp + gap * math.sin(a1) * factor))
            x += x_inc
            a1 += a_inc
        unclipped_lines.append(line)
        disp += gap

    unclipped_lines = [[
        StandardDrawing.rotate_about(x, centre, a) for x in line
    ] for line in unclipped_lines]
    c = math.cos(a)

    shape = [
        tl, tl + Point(side, 0), tl + Point(side, side), tl + Point(0, side)
    ]
    sf = ShapeFiller([shape])
    return sf.clip(unclipped_lines, inverse=True)
Beispiel #2
0
def make_hash_square(tl, side, gap, a):

    centre = tl + Point(1, 1) * side / 2
    r = side * math.sqrt(2)
    gap = 2
    disp = 0
    while disp > -r / 2:
        disp -= gap
    unclipped_lines = []
    while disp < r / 2:
        unclipped_lines.append(
            [centre + Point(-r / 2, disp), centre + Point(r / 2, +disp)])
        disp += gap

    unclipped_lines = [[
        StandardDrawing.rotate_about(x, centre, a) for x in line
    ] for line in unclipped_lines]
    c = math.cos(a)

    shape = [
        tl, tl + Point(side, 0), tl + Point(side, side), tl + Point(0, side)
    ]
    sf = ShapeFiller([shape])
    return sf.clip(unclipped_lines, inverse=True)