如何细分UIBezierPath并将其存储在两个不同的对象中
我的应用程序中有 UIBezierPath。当识别到路径上的手指触摸时,我想细分该曲线并将这两条曲线存储到两个不同的对象中。因此,触摸坐标将作为一条曲线的终点和第二条曲线的起点。
同样,如果我触摸这条曲线中的任何一条,该曲线将细分为另外两条曲线,依此类推。
我找了很多这个。但找不到什么好的解决办法。
我也不知道是否还有其他方法可以做到这一点。任何帮助将不胜感激。 谢谢
I have UIBezierPath in the application. When the finger touch on the path is recognized i want to subdivide that curve and store that two curves into two different objects. So touch co-ordinates will work as end-point for one curve and start-point for second curve.
Again if i touch on any of this curve, that curve will subdivide into two other curves and so on.
I searched for this a lot. But could not find any good solution.
Also I do not have idea if there is any other way to do this. Any help would be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用de Casteljau算法来做到这一点。如果您真的对数学感兴趣请查看此处的维基百科页面,但是如果你对数学不太感兴趣,当它实际上非常简单时,它可能会让你更加困惑......
现在您有两条新的贝塞尔曲线,第一个使用控制点 A1、B1、C1、D1,第二个使用 A2、B2、C2、D2。
You can do this with the de Casteljau algorithm. If you're really into the maths of it check out the Wikipedia page here, but if you're not that into the maths it will probably confuse you more than anything when it's actually quite simple...
Now you have two new Bezier curves, the first using control points A1, B1, C1, D1 and the second using A2, B2, C2, D2.