Provides two mathematical functions for drawing Bezier curves.
Marks an array of 2D points as a base for a Bezier curve.
Pre-computes factorials of 1..max for later execution. Call this function once, in the initialization part of your script. This speeds up creation of bezier curves using OAT.Bezier.create2() function. Set the max argument to the number of points.
Returns a Bezier functionf: [0,1] -> R^2 which describes parametric Bezier curve, based on points set by OAT.Bezier.setPointList().
Uses slow but precise recursive de Casteljau's algorithm .
Returns a Bezier functionf: [0,1] -> R^2 which describes parametric Bezier curve, based on points set by OAT.Bezier.setPointList().
Uses faster factorial algorithm based directly on Bernstein polynomials.
var points = []; points.push([0,0]); points.push([1,0]); points.push([1,1]); OAT.Bezier.setPointList(points); var f = OAT.Bezier.create2(); alert(f(0.5)); // [x, y] where x in [0,1], y in [0,1]