寻找贝塞尔曲线的控制点

发布于 2024-11-06 04:54:16 字数 291 浏览 0 评论 0原文

stackoverflow 的用户大家好!

首先,我想说这是我的第一篇文章,我一直在从这个网站上直接挖掘黄金,我喜欢它,每个人都足够聪明,可以给出解决方案。

所以基本上我正在写一个游戏,我有贝塞尔曲线来控制演员移动的位置。我只使用 3 个点(开始、控制 1、结束),一切都很好。

现在我想创建一条在 t = 0.5 处通过某个点 (r1) 的贝塞尔曲线。问题是我有起点、终点和 t=0.5 处的点 (r1),我需要找到控制点。

抱歉,如果我解释得不好,希望大家能够理解。

谢谢您的回复:)

Hi stackoverflow's users !

First i want to say its my first post and i've been diging straight up gold from this site and i love it and everyone out there smart enough to give out solutions.

So basically am writing a game and i have bezier curve that controls where an actor moves. Am using only 3 points (start, control1, end) and everything is fine.

Now i want to create a bezier curve that passes through a certain point (r1) at t = 0.5 . The problem being that i have my start point, my end point and my point (r1) at t=0.5, and i need to find the control point.

Sorry if i explained it badly i hope everyone can understand.

Thank you for any replies : )

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧情别恋 2024-11-13 04:54:16

Look into the documentation of Asymptote (here) which has a geometrical interpretation of the a spline. For the mid point (t=-.5) the point lies in the point m_5 below. If you are using one control point them c_0 and c_1 are coincident simplifying the math. If at (t=0.5) your y values is y_c and the beginning and ending values are respectively z_0 and z_1 then the control point is at

c = (8*y_c-z_0-z_1)/6

Do the same for the x values.

enter image description here

醉梦枕江山 2024-11-13 04:54:16

查看我几天前提出的问题: 给定f(x)线性函数,如何获得二次贝塞尔曲线控制点。我认为这正是您所需要的。

Check out the question I asked a couple of days ago: Given f(x) linear function, how to obtain a Quadratic Bezier control point. I think it's exactly what you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文