立方贝塞尔曲线通过三个点。

huangapple go评论86阅读模式
英文:

Cubic bezier curve that pass through 3 points

问题

有以下几个点:

  • P0(左上角)
  • P3(右下角)
  • 控制点 - 可以移动的点,曲线应通过它

我需要使用三次曲线将它们连接起来,以便曲线的末端是“大致水平的”,并且还可以移动控制点

所以我将P2放在坐标P0.x P3.y上(也许这是错误的决定)

现在我需要计算P1,使曲线通过控制点

我看到了一个很好的示例,使用了二次曲线
https://stackoverflow.com/a/66463100/20852881

之前我使用了这个示例中的二次曲线,但是现在需要使曲线的末端“大致水平”(对于这样的排列P0(左上角)和P3(右下角)),所以我转向了三次曲线

英文:

There are points:

  • P0 (left-top)
  • P3 (right-bottom)
  • Control Point - a point that can be moved, a curve should pass through it

I need to connect them using a cubic curve, so that the end of the curve is 'approximately horizontal' and it is also possible to move the Control Point

So I put P2 on the coordinates P0.x P3.y (maybe this is the wrong decision)

Now I need to calculate P1 so that the curve passes through the Control Point

I saw a good example with a quadratic curve
https://stackoverflow.com/a/66463100/20852881

Earlier i used the quadratic curve from this example, however, it became necessary to make the end of the curve 'approximately horizontal' (for such an arrangement P0 (left-top) and P3(right-bottom))
, so I look towards the cubic curve

答案1

得分: 0

这是我的Solid.js解决方案,基于文章1和主要参考文章2

https://codesandbox.io/s/interesting-architecture-2y5kgx

英文:

this is my solid-js solution, based on Article1 and mostly on Article2

https://codesandbox.io/s/interesting-architecture-2y5kgx

huangapple
  • 本文由 发表于 2023年8月4日 02:43:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76830854.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定