0

While I don't fully understand the math behind it I'm able to draw curves on an HTML5 canvas using createjs and filling in my values:

bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);

Now what I'd like to do is take a dynamic set of user drawn points from the canvas and from the points determine the degree to which they are curving.

I'd like to store a value of how much the line is curving compared to a normal straight line. Any points in the right direction would be helpful. I feel I'm just not using the correct wording in my search.

Joshua
  • 1,260
  • 3
  • 17
  • 33
  • It is not entirely clear what is the exact parameter that you seek. Those Bezier curves are the cubic case of the general Bezier curvs, with 2 end points and 2 control points. The math behind them is not extremely complex. Given the 4 points you can calculate just about anything. Some measures that come to mind are the difference between the initial/final derivatives and those of a straight line, or the max distance between the curve and a straight line normalized by the length of the line. Any ideas? – MasterAM Jun 29 '13 at 12:20
  • Thanks for the reply. I'm collecting points on a canvas while the mouse is moving. After the user finishes I'd like to take those points and determine how much the is curving compared to a straight line that I could quantify using simple numbers. For example a straight line might have a curve of 0, then that number would increase depending on the curve. – Joshua Jun 30 '13 at 07:53

0 Answers0