Skip to content

Instantly share code, notes, and snippets.

@hongkheng
Last active August 29, 2015 14:07
Show Gist options
  • Save hongkheng/93f25c283a6a05c632d2 to your computer and use it in GitHub Desktop.
Save hongkheng/93f25c283a6a05c632d2 to your computer and use it in GitHub Desktop.
Linear Interpolation formula
// Linear interpolation
function interpolateVal(y0:Number, y1:Number, x:Number, x1:Number, x0:Number):Number
{
//y = y0 + (x - x0) * (y1 - y0) / (x1 - x0);
return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment