Getting all points (not only control points) from

2019-08-10 10:37发布

问题:

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.

I saw these following questions:

Question 1

Question 2

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

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

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?

Cheers

回答1:

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.