-
Notifications
You must be signed in to change notification settings - Fork 951
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
turf/booleanContains #797
turf/booleanContains #797
Conversation
return output; | ||
} | ||
|
||
function isMultiPointInPoly(polygon, multiPoint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rowanwins Is the goal to implement the DE-9IM definitions of these functions? Because this approach is not implementing contains
definition. There is no check that any point falls in the interior. This allows all points to fall on boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gday @dpmcmlxxvi . Yep the aim is to match the DE-9IM, good pickup thank you. The sheer amount of scenarios that have to be catered for is huge, Im trying to include as many tests as required to make sure we covered them all off.
} | ||
} | ||
if (output) { | ||
if (compareCoords(lineString1.coordinates[0], lineString2.coordinates[0]) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rowanwins I think this assumes the lines are oriented the same way. Couldn't they be reversed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct again, the variations are many :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually on second read of the contains rules I think I can actually ditch this check
The pattern matrix of the ST_Contains predicate states that the interiors of both geometries must intersect and that the interior and boundary of the secondary (geometry b) must not intersect the exterior of the primary (geometry a).
Although in tidying it up I did find another little fix - ah the subtleties :)
return output; | ||
} | ||
|
||
function isLineInPoly(polygon, linestring) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rowanwins Same issue as above. contains
only requires that some line point is in the polygon interior, not necessarily a vertex. You can have a line in which vertices are entirely on the boundary but the line is still contained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes ok I can see where you're coming from on this one, very thorough reviewing thanks @dpmcmlxxvi :)
Just wondering why these are being called |
Gday @dpmcmlxxvi Thanks for the thorough review! I was including
|
Gday @dpmcmlxxvi & @DenisCarriere I've rejigged a couple of the checks as per comments from @dpmcmlxxvi . Performance still seems pretty good. I think the best thing we can to is keep thinking of scenarios and adding them to the tests (both positive and negative results). There are just so many flippin scenarios is hard to think through all of them as you write the code (perhaps I should add some more comments in the code to explain my thought logic). Anyway let me know if there are any further requests. |
}, | ||
"homepage": "https://github.com/Turfjs/turf", | ||
"devDependencies": { | ||
"@turf/bbox": "^4.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@turf/bbox
is repeated in both (dev)dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 All test cases look good to me.
npm test
at the sub modules where changes have occurred.npm run lint
to ensure code style at the turf module level../scripts/generate-readmes
to createREADME.md
.package.json
using "Full Name <@github Username>".Gday @DenisCarriere
Well I think this is hopefully almost done.
deep-compare
dependency,deep-compare
appears to be very slow. For example I went from 176,000 operations to 9,000,000 operationsbooleanContains
, that way the boolean part is explicit and people won't misinterpret what the module might doIt's taken a while but we're finally getting there :)