I have a question regarding formula curving through a control point.
As you know, HTML Canvas has quadraticCurveTo(x1, y1, x2, y2)
with x1 and x2
being the control point.
However when you try to draw a stroke using it, the stroke will never touch the control point.
So we have this formula:
x1 = xt * 2 - (x0 + x2) / 2;
y1 = yt * 2 - (y0 + y2) / 2;
(xt, yt)
= the point you want to curve through. t
for tangent as it is 90 degrees perpendicular at that point.
This recalculates the control point position.
I got this formula from a book, however the book doesn't explain how it is been derived. I tried google around but in vain.
Anyone knows how this formula is derived?
Thanks, Venn.