Getting all points (not only control points) from UIBezierPath
Asked Answered
B

1

1

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

Binding answered 29/1, 2014 at 12:48 Comment(7)
Yes, that is the solution.Matutinal
Makes sense, especially because "all of the points" in a path is mathematically an infinite number.Pentha
What are you actually trying to achieve?Calorie
@Pentha i updated the question, and you are right of of course, but i'm just thinking about sampling some points, maybe the stroked ones.Binding
@MartinR , i need to create a openGL ES object from these points, so in order to present that object, i need the points, and by that manually create vertices for the openGL ES objectBinding
I have no experience with OpenGL, but why do you need "all points"? Aren't there Bezier curves in OpenGL ES? Perhaps you can describe your intended result more precisely.Calorie
@MartinR there is no way (i know of) drawing bezier paths in openGL, so i'm creating x,y points and by that creating vertices and connecting them for an object creationBinding
G
-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.

Genital answered 29/1, 2014 at 12:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.