贝塞尔曲线连接 [英] bezier curve joining
问题描述
我在空间上相隔一定距离放置了两条贝塞尔曲线.
曲线1具有控制点A0,A1,A2,A3. A0和A3位于曲线上,并且是端点
曲线2具有控制点C0,C1,C2,C3. C0和C3位于曲线上,并且是端点
我想将两条曲线A和C与中间贝塞尔曲线B连接起来.中间曲线B具有控制点A3和C0,它们位于曲线上并作为端点.我不知道中间控制点B1和B2.连接也应该足够平滑.请就如何进行提供帮助.已经阅读过很多关于贝塞尔曲线的信息,但不知道如何做.
感谢和问候,
zoya
i have two bezier curves placed at a distance apart in space.
curve 1 has control points A0, A1,A2, A3. A0 and A3 lie on curve and are its end points
Curve 2 has control points C0,C1, C2, C3 . C0 and C3 lie on curve.and are its end points
i want to join the two curves A and C with an intermediate bezier curve B. the intermediate Curve B has control points A3 and C0 which lie on the curve and are its end points. theintermediate control points B1 and B2 are unknown to me. also the joining should be smooth enough. please help as to how to proceed. have read alot about beziers but dont know how to do this.
thanks and regards,
zoya
推荐答案
离开B0 = A3
和B3 = C0
确保 G0 的连续性(位置).选择B1
与A2A3
共线可确保 G1 在B0
处的连续性(方向),类似地选择B2
与C0C1
共线可确保 G1B3
处的连续性.
现在,B1
和B2
的放置仍然有两个自由度.我猜这些也可以用来实现 G2 的连续性(曲率).
现在一点数学.在以下文档中 http://www.tsplines.com/resources/class_notes/Bezier_curves.pdf [ ^ ],您会在第22页上找到一个有趣的公式,告诉您曲率等于h/a^2
(去掉常数n-1/n
),其中a
是控制多边形的第一条边的长度,而h
是从第二个控制点到目标点的垂直距离.控制多边形的第一条腿.
我们声明B1 = B0 + a U
和B2 = B3 + a'' V
,其中U
和V
分别是在B0B1
和B3B2
方向上的单位矢量.通过将B1B2
投影到U
和V
上获得h
和h''
:h = B1B2 /\ U = (B0B3 + a'' V) /\ U = p + q a''
,h'' = B1B2 /\ V = (B0B3 + a U) /\ V = p'' - q a
. (/\
是矢量乘积运算符,二维中2x2的行列式).
可以将其与从其他两个弧线计算出的端点处的已知曲率放在一起:
h = K a^2
和h'' = K'' a''^2
.
消除三个未知数可以使我们在a
中得到四次方程,因此有0到4个解.
LettingB0 = A3
andB3 = C0
ensures G0 continuity (location). ChoosingB1
to be collinear withA2A3
will ensure G1 continuity (direction) atB0
, and similarly choosingB2
to be collinear withC0C1
ensures G1 continuity atB3
.
Now there remain two degrees of freedom for the placement ofB1
andB2
. I guess that these can be used to achieve G2 continuity (curvature) as well.
Now a little bit of math. In the following document http://www.tsplines.com/resources/class_notes/Bezier_curves.pdf[^], you find an interesting formula on page 22, telling you that the curvature equalsh/a^2
(dropping the constantn-1/n
), wherea
is the length of the first leg of the control polygon, andh
is the perpendicular distance from the second control point to the first leg of the control polygon.
We state thatB1 = B0 + a U
andB2 = B3 + a'' V
, whereU
andV
are the unit vectors in the directions ofB0B1
andB3B2
respectively.h
andh''
are obtained by projectingB1B2
ontoU
andV
:h = B1B2 /\ U = (B0B3 + a'' V) /\ U = p + q a''
,h'' = B1B2 /\ V = (B0B3 + a U) /\ V = p'' - q a
. (/\
is the vector product operator, a 2x2 determinant in 2D).
This can be put together with the known curvatures at endpoints computed from the other two arcs:
h = K a^2
andh'' = K'' a''^2
.
Elimination of three unknowns gives us a quartic equation ina
, hence 0 to 4 solutions.
p + q a'' = K a^2<br />
p'' - q a = K'' a''^2<br />
<br />
=><br />
<br />
(p'' - q a) q^2 = K'' (K a^2 - p)^2
:-(
:-(
这篇关于贝塞尔曲线连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!