We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import { centroid, polygon } from "@turf/turf"; console.log(centroid(polygon([[[-1, -1], [1, -1], [1, 1], [-1, 1], [-1, -1]]])));
The result should be a point at (0, 0) but is actually (-0.2, -0.2). The algorithm is using the enclosing point twice.
(0, 0)
(-0.2, -0.2)
The text was updated successfully, but these errors were encountered:
Great pickup thanks @raviqqe
I'll get a fix for this within the v7 branch and add a test.
Sorry, something went wrong.
Resolve #1539 where incorrect centroid is calculated for polygon
2a64511
This is probably in development, but I just made a Fiddle using 7.0.0-alpha.1 and the centroid still seems off: https://jsfiddle.net/9z37srjb/3/
7.0.0-alpha.1
centroid
Yeah the change hasn't been released yet @vomc , it was added after the 7.0.0-alpha.1 release
rowanwins
Successfully merging a pull request may close this issue.
The result should be a point at
(0, 0)
but is actually(-0.2, -0.2)
. The algorithm is using the enclosing point twice.The text was updated successfully, but these errors were encountered: