Esempio n. 1
0
def bilerp(im, p):
    minX = floor(p[0])
    minY = floor(p[1])
    maxX = minX + 1
    maxY = minY + 1

    fracX = frac(p[0])
    fracY = frac(p[1])

    ll = im(float2(minX, minY))
    lr = im(float2(maxX, minY))
    ul = im(float2(minX, maxY))
    ur = im(float2(maxX, maxY))

    return lerp(lerp(ll, lr, fracX), lerp(ul, ur, fracX), fracY)
Esempio n. 2
0
def bilerp(im, p):
    minX = floor(p[0])
    minY = floor(p[1])
    maxX = minX+1
    maxY = minY+1

    fracX = frac(p[0])
    fracY = frac(p[1])

    ll = im(float2(minX, minY))
    lr = im(float2(maxX, minY))
    ul = im(float2(minX, maxY))
    ur = im(float2(maxX, maxY))

    return lerp(lerp(ll, lr, fracX), 
                lerp(ul, ur, fracX),  
                fracY)
Esempio n. 3
0
def half(im=RGBImage, p=Position):
    return im(p*float2(2,2))