Sampling SVG Bezier Curves in Javascript

// Sampling a Bezier curve
function pointAlongCubicBezier(t, start, c1, c2, end){
// adapted from http://stackoverflow.com/questions/9494167/move-an-object-on-on-a-bezier-curve-path
var u = 1 - t;
var tt = t*t;
var uu = u*u;
var uuu = uu * u;
var ttt = tt * t;

var p = {x: start.x*uuu, y:start.y*uuu};
p.x += 3 * uu * t * c1.x;
p.y += 3 * uu * t * c1.y;
p.x += 3 * u * tt * c2.x;
p.y += 3 * u * tt * c2.y;
p.x += ttt * end.x;
p.y += ttt * end.y;

return p;
}

function pointAlongQuadraticBezier(t, start, c1, end){
var u = 1 - t;
var tt = t*t;
var uu = u*u;

var p = {x: start.x*uu, y:start.y*uu};
p.x += 2 * u * t * c1.x;
p.y += 2 * u * t * c1.y;
p.x += tt * end.x;
p.y += tt * end.y;

return p;
}