Пример #1
0
def walking3():
    """
    Generate a tube or something like that.
    """

    tx = 100000

    s1 = Simple(1.3, 2, .209)
    s2 = Simple(1, 5, 0)
    s3 = Simple(1.5, 4, 0)

    times = [.01 * e for e in range(tx)]

    x_shift = .50


    rx = [0 for e in range(len(times))]


    xp = [s1.get_position(e) + x_shift * e for e in times] # x values

    yp = []
    for t in times:
        s2.frequency += .000005
        y0 = s2.get_position(t)
        yp.append(y0)


    zp = []
    for x,y in zip(xp, yp):
        zd = math.sqrt(abs(1 - y**2))
        zp.append(zd)
        
    points = [(x, y, z) for (x,y,z) in zip(xp,yp,zp)]
    return rs.AddPolyline(points)
Пример #2
0
def walking2():
    """
    Generate a tube or something like that.
    """

    tx = 200000

    s1 = Simple(1, 2, math.pi / 4)
    s2 = Simple(1, 3, 0)
    times = [.01 * e for e in range(tx)]
    x_shift = .10

    rx = [0 for e in range(len(times))]

    xp0 = []
    for t in times:
        s1.frequency += .000005
        x0 = s1.get_position(t) + x_shift * t
        xp0.append(x0)

    xp = xp0

    yp = [s2.get_position(e) + r for (e, r) in zip(times, rx)]


    zp = []
    for x,y in zip(xp, yp):
        zd = math.sqrt(abs(1 - y**2))
        zp.append(zd)
        
   
    points = [(x, y, z) for (x,y,z) in zip(xp,yp,zp)]
    return rs.AddPolyline(points)
Пример #3
0
def walking1():
    """
    Use the young guy's suggestion to add an x displacement to the process.
    """
    # Goal is to use this is some sort of highway decoration?
    # cf. Dan Christensen

    tx = 100000

    s1 = Simple(1.3, 2, .209)
    s2 = Simple(1, 5, 0)
    times = [.01 * e for e in range(tx)]
    x_shift = .20


    rx = [random.random() * .23 for e in range(len(times))]
    rx = [0 for e in range(len(times))]
    xp = [s1.get_position(e) + x_shift * e + r for (e, r) in zip(times, rx)]
    yp = [s2.get_position(e) + r for (e, r) in zip(times, rx)]

    s3 = None

    if s3:
        zp = [s3.get_position(e) for e in times]
    else:
        zp = [0 for e in times]
   
    points = [(x, y, z) for (x,y,z) in zip(xp,yp,zp)]
    return rs.AddPolyline(points)
Пример #4
0
def walking_select(lst):
    """
    Generate a tube or something like that.
    """



    samples = 1000000
    step = .01

    t_list = [step * e for e in range(samples)]

    x_shift = .10 # percentage to travel along x.

    s1 = Simple(1, 2, math.pi / 4)
    s2 = Simple(1, 3, 0)


    xp = []
    for t in t_list:
        s1.frequency += .000005
        x0 = s1.get_position(t) + x_shift * t
        xp.append(x0)


    curve_points = []

    for e in xp:
        try:
            point = interpolate_old(e, lst)
            curve_points.append(p2)
        except:
            break

    yp = [s2.get_position(e) for e in t_list]


    xx = []
    yy = []

    for point, x, y in zip(curve_points, xp, yp):
        x2, y2, _ = point
        xx.append(x+x2)
        yy.append(y+y2)

    zp = [math.sqrt(abs(1 - y**2)) for y in yp]

    points = zip(xx, yy, zp)

    return rs.AddInterpCurve(points)