title: Efficiently subdivide a bezier curve in javascript
body: <p>Given the start and end points and the two control points of a bezier curve, I would like to calculate the subdivisions (in JavaScript) to approximate the curve with straight line segments within an angular tolerance (avoid too much of an angle between segments). I mainly want to see if there is already an efficient open source algorithm out there before I try to write my own.</p>
  
  <p>Here is what I have found that is close do doing this:</p>
  
  <p><a href="https://github.com/turf-junkyard/turf-bezier" rel="nofollow noreferrer">https://github.com/turf-junkyard/turf-bezier</a> - although it's not quite the same, I could use some of the code, since I already have the spline.</p>
  
  <p><a href="https://github.com/seanchas116/bezier-subdivide" rel="nofollow noreferrer">https://github.com/seanchas116/bezier-subdivide</a> - this seems to do exactly what I want, although it looks like a recursive algorithm that would be costly to performance.</p>
  
  <p><a href="https://pomax.github.io/bezierjs/" rel="nofollow noreferrer">https://pomax.github.io/bezierjs/</a> - getLUT() could be useful but I would need a way to decide how many steps.</p>
  
  <p><a href="http://ciechanowski.me/blog/2014/02/18/drawing-bezier-curves/" rel="nofollow noreferrer">http://ciechanowski.me/blog/2014/02/18/drawing-bezier-curves/</a> - pretty much what I want, but this isn't in Javascript.</p>
  
  <p><a href="http://antigrain.com/research/adaptive_bezier/" rel="nofollow noreferrer">http://antigrain.com/research/adaptive_bezier/</a> - helpful theory.</p>