I would like to find the equation of a curve in the form y = ax2 + bx + c
from the following svg path:
<path id="curve1" d="M100,200 C100,100 400,100 400,200" />
this gives me 4 points that can be seen on the attached image.
wikipedia has a great article explaining bezier curves however I am not sure how to apply the maths shown there to get equation of the curve. http://en.wikipedia.org/wiki/B%C3%A9zier_curve
plotted curve, click to see image
You can't.
The SVG you're showing uses a cubic path, which uses a third order parametric curve, meaning it has the form:
fx(t) = x1 * (1-t)³ + x2 * 3 * (1-t)²t + x3 * 3 * (1-t)t² + x4 * t³
fy(t) = y1 * (1-t)³ + y2 * 3 * (1-t)²t + y3 * 3 * (1-t)t² + y4 * t³
(which is plotted for t going from 0, inclusive, to 1, inclusive).
So there are two reasons why you can't express that curve as a form y=ax²+b:
ax³+bx²+c instead, andy is expressed in terms of x at all, but instead both the x and y values are controlled by a "master parameter" t. We know that second degree functions like y=ax²+b can only model parabola, and looking at the image we can see that the plotted curve looks nothing like one of those (not even a squashed parabola) so we can't even "kind of sort of" approximate the curve with a second degree function in this case.
(sometimes you can get away with that, but definitely not in this case)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With