Skip to content
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

Fix some edge case on centroid computation #305

Merged
merged 3 commits into from
Oct 6, 2018

Conversation

antoine-de
Copy link
Contributor

On some edge cases the centroid computation was returning (NaN, Nan) points.

The edge cases were mainly when the area of a polygon was null (thus there was a division by 0).

I studied what libgeos does for this, and I created a jupyter notebook (using shapely that uses libgeos) to show what libgeos was returning for the different edge cases.

Note: as a side effect I had to update Failure version since criterion now use failure 0.1.2

update the failure crate, else there is a conflict with the criterion's
failure version
On some edge cases the centroid computation was returning (NaN, Nan)
points.

The edge cases were mainly when the area of a polygon was null.
Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@frewsxcv
Copy link
Member

frewsxcv commented Oct 6, 2018

bors r+

bors bot added a commit that referenced this pull request Oct 6, 2018
305: Fix some edge case on centroid computation r=frewsxcv a=antoine-de

On some edge cases the centroid computation was returning (NaN, Nan) points.

The edge cases were mainly when the area of a polygon was null (thus there was a division by 0).

I studied what libgeos does for [this](https://github.com/libgeos/geos/blob/master/src/algorithm/Centroid.cpp#L45-L65), and I created a [jupyter notebook](https://gist.github.com/antoine-de/7f995a43a765a4b19720a09467ba8c51) (using shapely that uses libgeos) to show what libgeos was returning for the different edge cases.


Note: as a side effect I had to update Failure version since criterion now use failure 0.1.2

Co-authored-by: Antoine D <antoine.desbordes@gmail.com>
@bors
Copy link
Contributor

bors bot commented Oct 6, 2018

Build succeeded

@bors bors bot merged commit abb698e into georust:master Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants