Warcraft III resources & community, 2003–2006 · archived

LinearInterpolation

not rated
Submitted by AIAndyCalculations0 downloads
Interpolates linearly in between x1/y1 and x2/y2 depending on the position of p.

Source

function LinearInterpolation takes real x1, real x2, real y1, real y2, real p returns real
  if p <= x1 then
    return y1
  elseif p >= x2 then
    return y2
  else
    return y1 + ((p - x1)/(x2 - x1)) * (y2 - y1)
  endif
endfunction

Comments

0

No comments.