aboutsummaryrefslogtreecommitdiff
path: root/chess/bezier.scad
blob: 8fb41e93253120aee9d55e740dd145b469aaab37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
function de_casteljau(points, t) = 
	len(points) == 1 ?
	points[0] : 
	de_casteljau(
		[for (i = [0:len(points)-2]) (1 - t) * points[i] + t * points[i + 1]], 
		t
	) ;

function bezier_curve(points, $fn=$fn) = 
	[for (i = [0:$fn]) de_casteljau(points, i / $fn)] ;