You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 on polygon functionality, is by really checking, if a point is on each line of polygon, therefore creating additional checks within classifyPointPolyPair.
The checks for pt within y range within classifyPointPolyPair vary just slightly ay <= py and by <= py vs ay < py and by < py . The latter is necessary for inside check, the former for on line check.
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...
Not sure what you prefer @postspectacular
@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...)
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: