解释 - 用于通过控制点进行曲线的公式 [英] Explain - Formula to curve through a control point
问题描述
我有一个关于公式通过控制点弯曲的问题。
正如你所知,HTML Canvas有 quadraticCurveTo(x1,y1,x2,y2)
和 x1和x2
是控制点。
但是,当您尝试使用它绘制笔划时,笔划将永远不会触及控制点。
所以我们有这个公式:
x1 = xt * 2-(x0 + x2)/ 2;
y1 = yt * 2-(y0 + y2)/ 2;
(xt,yt)
你想要通过。 t
用于切线,因为它在该点垂直90度。
重新计算控制点位置。
我从书中得到了这个公式,但是这本书并没有解释它是如何导出的。
任何人都知道这个公式是如何导出的。
谢谢,
Venn。
二次贝塞尔曲线由等式描述:
x(t)= x0 *(1-t)^ 2 + 2 * x1 * t *(1-t)+ x2 * t ^ 2
如果我们应用参数值t = 1/2(以某种方式 - 曲线中间),我们将得到您的公式: / p>
然后 I have a question regarding formula curving through a control point.
As you know, HTML Canvas has However when you try to draw a stroke using it, the stroke will never touch the control point. So we have this formula: 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. Quadratic Bezier curve is described by equations: If we apply parameter value t = 1/2 (in some way - middle of the curve), we will get your formula: then 这篇关于解释 - 用于通过控制点进行曲线的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! x(t = 1/2)= xt = x0 * 1/4 + 2 * x1 * 1/4 + x2 * 1/4
x1 / 2 = xt - (x0 + x2)/ 4
x1 = 2 * xt- code>
quadraticCurveTo(x1, y1, x2, y2)
with x1 and x2
being the control point.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.x(t) = x0 * (1-t)^2 + 2 * x1 * t * (1 - t) + x2 * t^2
(and similar for y(t)).x(t=1/2) = xt = x0 * 1/4 + 2 * x1 * 1/4 + x2 * 1/4
x1/2 = xt - (x0 + x2)/4
x1 = 2 * xt - (x0 + x2)/2