-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[geom] Point Inside Polygon - Point on Polygon #429
Comments
I am not sure if it is worth implementing this approach within pointInside component. Maybe it can be a separate classifyPolygon function. Since the only reasonable way to get The checks for pt within y range within classifyPointPolyPair vary just slightly While this decreases performance for point inside checking, it might actually be bit faster, if point is on polygon, since we can just skip iterating over follow up lines of a polygon. I have it in my code base now... |
@dennemark - Looks good & I'm thinking about this, but will have to refamiliarize with the details of that code first (in a different head space right now...) |
@postspectacular I stumbled over this one again. Used my above code in our repository, but nearly deleted it for the actualy thi.ng/geom function. Though I prefer the -1, 0, 1 check. If there is some space, would you be able to look into this? |
@dennemark I'm hoping to revisit this once more this week, since I've been working on another set of various major changes to the geom package, mainly related to better return types (#467), but also been adding various new shape types (incl. 3D) and updating type support for many operators.... |
very nice! thanks a lot :) |
Hi @dennemark — so this should all be done now (updated your version to allow for specifying tolerance). Also included a new example to test & verify visually: Demo: Source: |
I am wondering, if it is possible to extend the pointInside function and add a possibility to know if point is on polygon.
Since classifyPoint works with -1, 0 and 1 instead of boolean like pointInside, I think it would be possible to integrate the following functions inside classifyPoint and keep pointInside as is.
The algorithm looses a bit of efficiency though.
umbrella/packages/geom/src/classify-point.ts
Line 40 in 65dc2a5
umbrella/packages/geom-isec/src/point.ts
Line 184 in d48377c
Tested for these cases, feel free to test more.
The text was updated successfully, but these errors were encountered: