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

Community
  • 1
  • 1
Itzik984
  • 15,968
  • 28
  • 69
  • 107
  • Yes, that is the solution. – Wain Jan 29 '14 at 12:50
  • 2
    Makes sense, especially because "all of the points" in a path is mathematically an infinite number. – Stavash Jan 29 '14 at 12:51
  • 1
    What are you actually trying to achieve? – Martin R Jan 29 '14 at 12:52
  • @Stavash i updated the question, and you are right of of course, but i'm just thinking about sampling some points, maybe the stroked ones. – Itzik984 Jan 29 '14 at 12:54
  • @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 object – Itzik984 Jan 29 '14 at 12:55
  • 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. – Martin R Jan 29 '14 at 13:00
  • @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 creation – Itzik984 Jan 29 '14 at 13:40

1 Answers1

-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.

Oleg Fedorov
  • 337
  • 3
  • 10