Search code examples
javascriptvectorpaperjs

Paper.js intersection pulling node position out of path object


I am trying to utilise paper.js to get a node and its handle positions resulting from an intersection of two paths. I don’t need to render the result, I only need to position for further processing. The two open paths are as the following image illustrates:

enter image description here

I would know the exact coordinates of the red highlighted node and handles. How can I pull this information out of the path object? Does that work with non-closed paths?


Solution

  • You can get path intersections with path.getIntersections() and split it with path.splitAt().

    The path.firstSegment.handleIn and path.lastSegment.handleOut will give you the handle positions.