简体   繁体   English

在二次贝塞尔曲线上找到控制点

[英]Find control point on Quadratic Bezier Curve

I drew a Quadratic Bezier curve.我画了一个二次贝塞尔曲线。 Here A(0, 1.39) and B(30, 1.42) are two points and curves drawn with a single control point (15.02, 6.07).这里 A(0, 1.39) 和 B(30, 1.42) 是使用单个控制点 (15.02, 6.07) 绘制的两个点和曲线。 二次贝塞尔曲线

I want to move point B along the curve.我想沿曲线移动点 B。 But When I move the curve shape changes.但是当我移动曲线形状时会发生变化。 So I want to move the control point also with respect to point B.所以我也想相对于 B 点移动控制点。

Pic: Point moved but not control point moved so curve disoriented.图片:点移动但控制点未移动,因此曲线迷失方向。 移动 B 点扭曲的曲线

Pic: Point and Control point moved, so the curve is in proper shape.图:点和控制点移动了,所以曲线是正确的形状。 CP也感动

The blue shape is for reference.蓝色形状供参考。 Kindly help me to find the control point on moving point B.请帮我找到移动点 B 上的控制点。

You need to subdivide curve onto two new smaller curves.您需要将曲线细分为两条新的较小曲线。 To calculate control point of "left" new curve, when you subdivide large curve at parameter t (in range 0..1):要计算“左”新曲线的控制点,当您在参数 t 处细分大曲线时(在 0..1 范围内):

left_P[1] = large_P[0] * (1-t) + large_P[1] * t

All points of left curve:左曲线的所有点:

left_P[0] = large_P[0]   //initial point
left_P[1] = large_P[0] * (1-t) + large_P[1] * t   //control point
left_P[2] = large_P[0] * (1-t)^2 + 2*large_P[1] * t*(1-t) + large_P[2] * t^2   //last point, coincides with your moving point

For your example t is about 0.7, and对于您的示例, t约为 0.7,并且

new_C = 0.3*A + 0.7*C

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM