从 UIBezierPath 获取所有点(不仅是控制点) [英] Getting all points (not only control points) from UIBezierPath

查看:35
本文介绍了从 UIBezierPath 获取所有点(不仅是控制点)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了一个 UIBezierPath,我可以访问定义的相关点.

I have a UIBezierPath which i defined, and i can access the relevant points defined.

现在,我想提取直线中的所有点,而不仅仅是我定义的点.

Now, i want to extract all the points in the line, not just the points i defined.

我看到以下问题:

问题 1

问题 2

我想知道使用所选答案是否会给出我想要的结果,意思是:

And i was wondering if using the answers selected will give the result i want, meaning:

1) 按照问题 1 中的建议提取所有点(已经拥有它们)

1) Extract all points (already have them) as suggested in question 1

2) 按照问题 2 中的建议计算每对(或三元组)点之间的所有点

2) Calculate all the points between each pair (or triplet) of points as suggested in question 2

这是解决这个问题的正确方法吗?还有其他解决办法吗?

Is this the right approach for this problem? is there any other solution?

也许可以画一条线,然后以某种方式检索所有显示的点?

Maybe stroke the line and than retrieve all the shown points somehow?

干杯

推荐答案

如果它不是时间关键代码并且您需要准确地获得积分,那么同样疯狂的想法:如果您将此路径绘制为带有黑色像素线的白色图像,然后仅从该图像中获取黑点的所有位置会怎样?它将为您提供这条路径上所有点的精确坐标.

Just as crazy idea if it is not time critical code and you need to get points exactly: what if you draw this path into white image with black one pixel line and then just take all positions of black points from this image? It will give you exact coordinates for all points from this path.

它会非常慢但非常精确.

It will be extremely slow but very precise.

这篇关于从 UIBezierPath 获取所有点(不仅是控制点)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆