二次贝塞尔曲线数学 [英] Quadratic bezier curve math
问题描述
有人可以帮我这个忙吗? 当我有这样的贝塞尔曲线时: https://www.w3schools.com/code/tryit.asp?filename= FX0KJBP2EZ3S
Can someone help me with this: When I have a bezier curve like this: https://www.w3schools.com/code/tryit.asp?filename=FX0KJBP2EZ3S
P0(X) = 0 P0(Y) = 50
P1(X) = 100 P1(Y) = 25
P2(X) = 200 P2(Y) = 50
并使贝塞尔曲线变小:
https://www.w3schools.com/code/tryit.asp ?filename = FX0KL478CRY4
由于距离P0.X和P2.X,P1较高.如何保持P1的高度始终保持在同一高度?
the P1 is higher due to the distance P0.X and P2.X. How can I keep the height of P1 so it is allways in the same height?
推荐答案
要按比例缩小曲线(使形状相同但更小),您必须以相同的比例更改控制点的差异.因此,应将Y1-Y0
更改为与(X2'-X0')/(X2-X0)
:25 / (200/50) = 6.25
类似.整数:
To shrink curve proportionally (to make the same form but smaller) you have to change differences of control points in the same ratio. So Y1-Y0
should be changed similar to (X2'-X0')/(X2-X0)
: 25 / (200/50) = 6.25
. In integers:
ctx.quadraticCurveTo(25, 44, 50, 50);
这篇关于二次贝塞尔曲线数学的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!