-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add failing test demonstrating convex hull bug #912
Conversation
@@ -111,206 +111,4 @@ fn swap_remove_to_first<'a, T>(slice: &mut &'a mut [T], idx: usize) -> &'a mut T | |||
} | |||
|
|||
#[cfg(test)] | |||
mod test { |
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.
unrelated to this failing test, but because this mod test { ... }
is defined here, the adjacent test.rs
was previously ignored
I wonder whether this is an fp precision bug. Those coordinates are awfully long. |
Note that changing |
As @rmanoka alluded, I think that the new test is invalid because polygons don't A simpler example would be to consider any triangle - whose convex hull will be the triangle itself.
So I think we should incorporate the test fixes (thanks!) but delete or update the new failing test. |
Not suggesting we do it in this pull request, but would it be possible to add a robust convex hull algorithm? And if so, how difficult would that be? |
Good question. I'm not sure if it's currently robust or not. I know that we're using Kernel::orient2d, which is robust, but maybe there is some other math to worry about. Do you have an example input that produces unexpected results for the convex hull due to robustness issues? Just to be clear - I don't think the issues raised by the currently failing test are related to robustness/numerical accuracy issues. Rather, I think that failure is an incorrect assumption in the new test about the (frequently surprising) definition of what The test assumes that the convex hull of a set of points won't have any of those points on its boundary, but that's not how convex hulls work. Are we on the same page there @frewsxcv? |
To consolidate some conversation that is happening both here and in discord:
@frewsxcv noticed in rgis that when using our concave hull algorithm, some points appeared outside of the hull: Then, he created a failing unit test to encapsulate this perceived failure, that's where this PR came from. However, the unit test was failing due to other reasons — the use of the incorrect predicate. It was using Then why this observed behavior of points being rendered outside their concave hull? I believe it's a projection issue: the data is in WGS84 (degrees) but rgis was rendering in EPSG:3857 (meters). Operations in rgis work on whatever native coordinates the data has (i.e. WGS84), not the rendered projection (EPSG:3857). I think this is reasonable behavior, as we have to assume our input data is the most correct for whatever operations we are doing. If you want perform your operations in a different projection, explicitly project it first. If you want to view the data in its native projection, rgis actually supports this (nice!). Using that feature you can see something more like what you might have been expecting (feel free to jump ahead to 60s for the important part): rgis-proj.mov.mp4Note the screen recording captures a couple UI bugs in rgis which I'll file upstream:
|
👑 |
923: Restore convex hull tests r=frewsxcvc a=michaelkirk - [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md). - [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users. --- Supersedes #912 which had two goals: **goal 1:** Run our existing tests, some of which we were accidentally skipping. **goal 2:** added a new test to demonstrate a presumed bug, but this test was based on incorrect assumptions. I've taken away the test from goal 2, so that this PR is now only about making sure we're running our existing tests. Co-authored-by: Corey Farwell <[email protected]> Co-authored-by: Michael Kirk <[email protected]>
Superseded by #923 which included the test fixes, but not the new test. |
CHANGES.md
if knowledge of this change could be valuable to users.The points listed below are not contained within the convex hull