How to get the total number of points on the curve path?

Please help, I used the getPointAlongPath() method to get the (x,y value) on the curve path, but how do I get the total number of points on the curve path?Any ideas? thank you very much!

Is this of any use?

1 Like

Path::getPointAlongPath is returning an interpolated point along the path, not necessarily one of the points you’ve used to create the path. For example, in the case of adding a cubic segment, the second and third points will frequently not be on the path because they’re control points for the segment.

What are you trying to do with the points?

I’m wondering how can I get how many interpolation points there are on a curve?

That depends. It uses the PathFlatteningIterator:

the amount by which the curves are allowed to deviate from the lines into which they are being broken down - a higher tolerance contains less lines, so can be generated faster, but will be less smooth.

PathFlatteningIterator will convert a path to a series of line segments. So you could easily use that to count the number of line segments. From there you can probably work out the number of points based on whether the path is closed or not.