Hi,
I was wondering if anybody could figure this out. I'm trying to get simple cosine interpolation working between two points (x1,y2)(x2,y2).
This is what I have:
x1 = 100
y1 = 100
x2 = 200
y2 = 200
ink rgb(255,0,0),0
line x1,y1,x2,y2
ink rgb(255,255,255),0
for t = 1 to 10
inc mu#,0.1
ix = int(InterpolateX(x1,x2,mu#))
iy = int(CosineInterpolateY(y1,y2,mu#))
dot ix,iy
next t
sync
wait key
function InterpolateY(y1,y2,mu#)
returnval# = (y1*(1-mu#)+(y2*mu#))
endfunction returnval#
function InterpolateX(x1,x2,mu#)
diff = x2 - x1
returnval# = (x1*1.0) + (diff * mu#)
endfunction returnval#
function CosineInterpolateY(y1,y2,mu#)
mu2# = (1-cos(mu#*(3.1412)))/2;
returnval# = InterpolateY(y1,y2,mu2#)
endfunction returnval#
Which basically boils down to my equation for interpolation being
mu# = [value between 0.0 and 1.0]
mu2# = (1-cos(mu#*(3.1412)))/2
interpolatedy# = (y1*(1-mu2#)+(y2*mu2#))
Yet I get returned the original y1 value. Anybody help (doubt it, bit of a niche this)?
Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.