예제 #1
0
def curvemaker2(pointlist, height, xamount, yamount, displength, dispwidth):
    def mapping(t, pointlist):
        return general_bezier_mapping(t, pointlist)

    def func(x, y):
        return [mapping(x, pointlist)[0], y * height, mapping(x, pointlist)[1]]

    ps.filewriter(xamount, yamount, displength, dispwidth, func, 2)
예제 #2
0
def along_interp_maker(longlist, pointlistlist, xamount, yamount, displength,
                       dispwidth):
    def newfunc(x, y):
        def makelambda(list):
            return lambda s: general_bezier_mapping(s, list)

        funclist = []
        for elem in pointlistlist:
            funclist.append(makelambda(elem))
        list_length = len(funclist) - 1

        # still need to write something for a length of 1

        def func(x, y, i, funclist):

            start = i / list_length
            end = (i + 1) / list_length
            if y <= end:
                #print(start, end)
                # print(i)
                return np.array(
                    interp(funclist[i + 1],
                           funclist[i],
                           x,
                           y,
                           start=start,
                           end=end))
            else:
                return func(x, y, i + 1, funclist)

        return func(x, y, 0, funclist)

    ll = longlist
    rate = 1.5

    def mapping(t):
        return np.array([
            general_bezier_mapping(t, ll)[0],
            general_bezier_mapping(t, ll)[1]
        ])

    def newmapping(x, y):
        #return mapping(x)+y*nvec.normal(mapping,x)*height
        return mapping(x) - rate * newfunc(y, x)[0] * nvec.normal(
            mapping, x / 1.00001)

    def func(x, y):
        return [
            newmapping(x, y)[0],
            newmapping(x, y)[1], rate * newfunc(y, x)[1]
        ]

    ps.filewriter(xamount, yamount, displength, dispwidth, func, 2)
예제 #3
0
def interpmaker(pointlist1, pointlist2, height, xamount, yamount, displength,
                dispwidth):
    curve1 = lambda t: general_bezier_mapping(t, pointlist1)
    curve2 = lambda t: general_bezier_mapping(t, pointlist2)

    def func(x, y):
        return [
            interp(curve1, curve2, x, y)[0],
            interp(curve1, curve2, x, y)[1], y * height
        ]

    ps.filewriter(xamount, yamount, displength, dispwidth, func, 2)
예제 #4
0
def general_interpmaker_top(pointlistlist, height, xamount, yamount,
                            displength, dispwidth):
    def makelambda(list):
        return lambda s: general_bezier_mapping(s, list)

    funclist = []
    for elem in pointlistlist:
        funclist.append(makelambda(elem))
    list_length = len(funclist) - 1

    # still need to write something for a length of 1

    def func(x, y, i, funclist):

        start = i / list_length
        end = (i + 1) / list_length
        if y <= end:
            #print(start, end)
            # print(i)
            return [
                interp(funclist[i + 1],
                       funclist[i],
                       x,
                       y,
                       start=start,
                       end=end)[0], y * height,
                interp(funclist[i + 1],
                       funclist[i],
                       x,
                       y,
                       start=start,
                       end=end)[1]
            ]
        else:
            return func(x, y, i + 1, funclist)

    newfunc = lambda x, y: func(x, y, 0, funclist)

    ps.filewriter(xamount, yamount, displength, dispwidth, newfunc, 2)
예제 #5
0
def along_normal_maker(pointlist, height, xamount, yamount, displength,
                       dispwidth):
    pl = pointlist

    def mapping(t):
        return np.array([
            general_bezier_mapping(t, pl)[0],
            general_bezier_mapping(t, pl)[1]
        ])

    def newmapping(x, y):
        #return mapping(x)+y*nvec.normal(mapping,x)*height
        return mapping(x) + height * np.cos(y * 2 * np.pi) * nvec.normal(
            mapping, x / 1.00001)

    def func(x, y):
        return [
            newmapping(x, y)[0],
            newmapping(x, y)[1],
            np.sin(y * 2 * np.pi) * height
        ]

    ps.filewriter(xamount, yamount, displength, dispwidth, func, 2)
예제 #6
0
def along_curve_maker(longlist, shortlist, xamount, yamount, displength,
                      dispwidth):
    ll = longlist
    sl = shortlist
    rate = 1.5

    def mapping(t):
        return np.array([
            general_bezier_mapping(t, ll)[0],
            general_bezier_mapping(t, ll)[1]
        ])

    def curve(s):
        return general_bezier_mapping(s, sl)

    def newmapping(x, y):
        #return mapping(x)+y*nvec.normal(mapping,x)*height
        return mapping(x) - rate * curve(y)[0] * nvec.normal(
            mapping, x / 1.00001)

    def func(x, y):
        return [newmapping(x, y)[0], newmapping(x, y)[1], rate * curve(y)[1]]

    ps.filewriter(xamount, yamount, displength, dispwidth, func, 2)