贝塞尔曲线算法 - 也许是规范样条曲线?
我有一条由多个点组成的路径 - 即 0,0 0,50 50,50 70,20
如果我只是在屏幕上画这条线,它看起来相当粗糙,因为它在连接处设置了一个锐角每个点。
因此,我想知道贝塞尔曲线算法/方法会是什么样子,我可以称之为自动将锐角更改为“紧”曲线?
我不希望曲线太大或通常影响主路径的下降,只需软化连接即可。如果您看一下下面的内容,这是我整理的一个快速示例。左边的线是我现在拥有的,中间的线是我想要的。
右图代表了我认为我需要算法完成的任务。本质上,我向每个弧添加一个附加点,该点在距离连接 10% 的点处构成连接,然后删除连接点并调整手柄,使它们位于该点所在的位置(不是在图中)稍微分开,这只是为了让您可以看到)。这就是我需要能够做到的。
I've got a path that is made up of multiple points - i.e. 0,0 0,50 50,50 70,20
If I just draw this line on the screen it looks quite harsh as it puts a sharp angle at the joining of each point.
Hence I was wondering what the bezier curves algorithm/method would look like which I could call that automatically change the sharp angles to "tight" curves?
I wouldn't want the curve to be too big or generally effect the fall of main path, just soften the join out. If you have a look at the below here is a quick sample I have put together. The line on the left is what I have now, the one in the middle is the line I want.
The image on the right represents what I think I need the algorithm to do. Essentially, I add an additional point to each arc that makes up the join at a point which 10% away from the join, then I remove the join point and adjust the handles so that they are where the point was (not in the diagram they are slightly apart, this is just so that you can see). This is what I need to be able to do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
呃...只需添加一个 BezierSegment 到您的 PathSegmentCollection。
Er.... just add a BezierSegment to your PathSegmentCollection.
因此,您需要为每个“角”点确定 2 个附加点。 “角”点是沿路径的任何内部点。
这是一个开始:
So you need to identify 2 additional points per "corner" point. A "corner" point being any interior point along the path.
Here is a start: