point in polygon

75 views
Skip to first unread message

dusadrian

unread,
Nov 9, 2022, 2:37:15 AM11/9/22
to Raphaël
Hi everyone,

I am trying to check if a point of coordinates (x, y) is inside or outside a polygon (of any irregular shape).

Is there a way to check that in Raphael, by any chance?

Thanks in advance,
Adrian

Ian

unread,
Nov 9, 2022, 4:07:11 AM11/9/22
to Raphaël
I'm not sure Raphael has this. I'd be tempted to update to Snap.svg a more modern sister version of Raphael, which has http://snapsvg.io/docs/#Snap.path.isPointInside there's a lot of backwards compatibility, and it supports svg properly with groups etc.

If you still are stuck, there's some algorithms out there for point in poly checking.

dusadrian

unread,
Nov 10, 2022, 4:33:51 PM11/10/22
to Raphaël
Thanks, Ian.
I could not make Snap work into my Electron app, so had to convert all paths to an array of absolute coordinates to use a point in poly algorithm.

All the best,
Adrian

Reply all
Reply to author
Forward
0 new messages