Best way to find intersection

What is the best way to find intersection coordinates of two paths via Glyphs?
Or is there something like layer.intersectionsBetweenPoints() but for path?

I’ve found path.bezierPath.intersectionWithLine_lineStart_lineEnd_() , but what arguments are required?

This is not officially documented but you can get good hints by looking at the headers in /Applications/ I usually open the whole folder in my text editor and do a multi-file search for the method or class in question.

In this case the file NSBezierPath-OAExtensions.h contains the definition (in ObjectiveC):

- (BOOL)intersectionWithLine:(NSPoint *)result lineStart:(NSPoint)lineStart lineEnd:(NSPoint)lineEnd;

That suggests you need three NSPoints as parameters but I have not tested it. Does it work for you?

Thanks for help, Tim.

I can’t figure out what I need to send as (NSPoint *)result

ValueError: deponitize a pointer, received an NSPoint

Did you set up an NSPoint first and then pass it to the method (as opposed to constructing one in-line)?

But, to be honest, that’s beyond my PyObjC knowledge. @GeorgSeifert?

The (NSPoint *) means that the value is returned by reference. So in python, you normally put in a None and the result will be returned as a tuple.

What exactly are you trying to do?

Glyphs crashes when I run this code.

I want to find coordinates of intersection of 2 paths or path and line using Glyphs built-ins.

With the current build in functions, your first idea is probably the best. You can make a new layer, put a copy of both paths in it and run newLayer.intersectionsBetweenPoints().