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 polygon centroid for flat polygon #203

Merged
merged 1 commit into from
Apr 18, 2018
Merged

Conversation

antoine-de
Copy link
Contributor

@antoine-de antoine-de commented Apr 18, 2018

if the polygon is flat (area = 0), it is considered as a linestring for the centroid computation.

without this for a flat polygon eg:

A ----> B -----> C
^----------------|

the centroid was Some(NaN, NaN)

without this, the test empty_interior_polygon_test was also causing a panic! because of the unwrap in the centroid method.

if the polygon is flat (area = 0), it is considered as a linestring

without this for a flat polygon eg:

A ----> B -----> C
^----------------|

the centroid was `Some(NaN, NaN)`
@urschrei
Copy link
Member

Good catch. Thank you!

@urschrei
Copy link
Member

bors r=urschrei

bors bot added a commit that referenced this pull request Apr 18, 2018
203: fix polygon centroid for flat polygon r=urschrei a=antoine-de

if the polygon is flat (area = 0), it is considered as a linestring for the centroid computation.

without this for a flat polygon eg:

A ----> B -----> C
^-------------------|

the centroid was `Some(NaN, NaN)`

without this, the test `empty_interior_polygon_test` was also causing a `panic!` because of the unwrap in the centroid method.

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

bors bot commented Apr 18, 2018

Build succeeded

@bors bors bot merged commit 1d1437c into georust:master Apr 18, 2018
@antoine-de
Copy link
Contributor Author

great, thanks!

when do you think this will be released?

@urschrei
Copy link
Member

@antoine-de released to crates.io as 0.8.1

@antoine-de
Copy link
Contributor Author

thanks 👍

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.

None yet

2 participants