Created
April 18, 2020 21:24
-
-
Save jhorikawa/2527c150ada263c117bbf27ffed594f4 to your computer and use it in GitHub Desktop.
Bezier basis function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function splinePt(points, i, n, t){ | |
let pt1, pt2; | |
if(n == 1){ | |
pt1 = points[i]; | |
pt2 = points[i+1]; | |
}else{ | |
pt1 = splinePt(points, i, n-1, t); | |
pt2 = splinePt(points, i+1, n-1, t); | |
} | |
let npt = p5.Vector.add(p5.Vector.mult(pt1, (1.0-t)), p5.Vector.mult(pt2, t)); | |
return npt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment