Question regarding Path class


#1

If Path::getPointAlongPath().getY() returns a Y-value a given distance from the start of the path, is there any method that will return a Y-value at a given distance along the X-axis of a rectangle that houses the Path, see attached image. I'm writing a simple envelope generator, and Path is great so far, but I've no interest in finding out the Y position along the length of the path. It's the y position along the x-axis I need access to. I'm hoping I don't need to break out the trigonometry textbooks..


 

 


#2

You could use a Path::Iterator to iterate each line segment along the path, and the use Line::intersects and Line::getIntersection to find where one of them crosses a vertical line at your chosen x pos?


#3

Thanks Jules, I think I was missing the forest for the trees here. I was already positioning handles along the path every time it changed direction. In the end I only had to interpolate between the coordinates of these handles. I think it could also be done with just the info contained in the Path::Iterator class. I'll need to do me some learning on the Line class.