Ejemplo n.º 1
0
def star_pts(r=1, ir=None, points=5, center=(0, 0)):
    '''Create points for a star. They are 2d - z is always zero
    
    r: the outer radius
    ir: the inner radius
    '''
    if not ir: ir = r / 5
    pts = []
    dt = pi * 2 / points
    for i in range(points):
        t = i * dt
        ti = (i + .5) * dt
        pts.append(angle_point(center, t, r))
        pts.append(angle_point(center, ti, ir))
    return map(zzero, pts)
Ejemplo n.º 2
0
def star_pts(r=1, ir=None, points=5, center = (0, 0)):
    '''Create points for a star. They are 2d - z is always zero
    
    r: the outer radius
    ir: the inner radius
    '''
    if not ir: ir = r/5
    pts = []
    dt = pi * 2 / points
    for i in range(points):
        t = i * dt
        ti = (i + .5) * dt
        pts.append(angle_point(center, t, r))
        pts.append(angle_point(center, ti, ir))
    return map(zzero, pts)
Ejemplo n.º 3
0
def braid_line(center,
               radius,
               strands,
               sides,
               spacing=.4,
               thickness=.2,
               resolution=1):
    cx, cy = center
    # sides = 6
    numpoints = strands * (sides * strands + 1) * resolution / 2 - 6
    dtheta = 2 * pi / (sides * resolution * 12 / 5)
    steps = (strands - 1) * 2
    #    dz = dtheta * pi

    a = pi / steps
    b = pi / 2
    # 5 sides, 1
    # 8 sides, 4
    # 7 sides, 3
    for i in range(0, int(numpoints)):
        i /= resolution
        r = sin(b * i) * thickness
        x, y = angle_point(center, i * dtheta, radius + r)
        #x = r
        #y = i/3
        z = cos(i * a) * spacing
        yield x, y, z
Ejemplo n.º 4
0
def circlify(points, gap=None, circles=1):
    zavg = sum(p[2] for p in points) / len(points)
    # yavg = sum(p[1] for p in points) / len(points)
    x, y, z = points[0]
    ylast = points[-1][1]
    w = (ylast - y) / circles
    radius = w / 2 / pi
    center = 0, 0
    if gap is None:
        gap = (ylast - y) / len(points)
    for a, b, c in points:
        down = (ylast - b) / (w + gap) * 2 * pi
        r = radius + (c - zavg)
        ny, nz = angle_point(center, down, r)
        yield a, ny, nz
Ejemplo n.º 5
0
def circlify(points, gap = None, circles=1):
    zavg = sum(p[2] for p in points) / len(points)
    # yavg = sum(p[1] for p in points) / len(points)
    x,y,z = points[0]
    ylast = points[-1][1]
    w = (ylast - y) / circles
    radius = w / 2 / pi
    center = 0, 0
    if gap is None:
        gap = (ylast - y) / len(points)
    for a,b,c in points:
        down = (ylast - b) / (w + gap) * 2 * pi
        r = radius + (c - zavg)
        ny, nz = angle_point(center, down, r)
        yield a, ny, nz
Ejemplo n.º 6
0
def braid_line4(center, radius, strands, sides, spacing=.4, thickness=.2, resolution=1):
    cx, cy = center

    numpoints = strands * (sides * 4) * resolution
    dtheta = 2 * pi / (sides * resolution * 3)
    steps = (strands - 1) * 2
#    dz = dtheta * pi
    
    a = pi / steps
    b = pi / 2
    for i in range(0, numpoints - sides * strands):
        i /= resolution
        r = sin(b * i) * thickness
        x, y = angle_point(center, i * dtheta, radius + r)
        #x = r
        #y = i/3
        z = cos(i * a)
        yield x, y, z
Ejemplo n.º 7
0
def braid_line(center, radius, strands, sides, spacing=.4, thickness=.2, resolution=1):
    cx, cy = center
    # sides = 6
    numpoints = strands * (sides * strands + 1) * resolution / 2 - 6
    dtheta = 2 * pi / (sides * resolution * 12/5)
    steps = (strands - 1) * 2
#    dz = dtheta * pi
    
    a = pi / steps
    b = pi / 2
    # 5 sides, 1
    # 8 sides, 4
    # 7 sides, 3
    for i in range(0, int(numpoints)):
        i /= resolution
        r = sin(b * i) * thickness
        x, y = angle_point(center, i * dtheta, radius + r)
        #x = r
        #y = i/3
        z = cos(i * a) * spacing
        yield x, y, z
Ejemplo n.º 8
0
def braid_line4(center,
                radius,
                strands,
                sides,
                spacing=.4,
                thickness=.2,
                resolution=1):
    cx, cy = center

    numpoints = strands * (sides * 4) * resolution
    dtheta = 2 * pi / (sides * resolution * 3)
    steps = (strands - 1) * 2
    #    dz = dtheta * pi

    a = pi / steps
    b = pi / 2
    for i in range(0, numpoints - sides * strands):
        i /= resolution
        r = sin(b * i) * thickness
        x, y = angle_point(center, i * dtheta, radius + r)
        #x = r
        #y = i/3
        z = cos(i * a)
        yield x, y, z