Skip to content

Instantly share code, notes, and snippets.

@slvrfn
Created July 24, 2019 03:30
Show Gist options
  • Save slvrfn/0039032857e3ca53cddf4069b776b1bd to your computer and use it in GitHub Desktop.
Save slvrfn/0039032857e3ca53cddf4069b776b1bd to your computer and use it in GitHub Desktop.
//obtain new point on the line defined by (x0,y0) to (x1,y1)
//a t in the range [0,1] sits on the line
//a t > 1 sits on the line past (x1,y1)
function proj(x0, y0, x1, y1, t){
return [((1-t)*x0)+(t*x1), ((1-t)*y0)+(t*y1)];
}
//https://math.stackexchange.com/a/1630886/368351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment