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

spherical polygon area #395

Closed
penghao94 opened this issue Apr 19, 2017 · 2 comments
Closed

spherical polygon area #395

penghao94 opened this issue Apr 19, 2017 · 2 comments

Comments

@penghao94
Copy link

Hi,
there may be a bug in calculating the area of spherical polygon. when the polygon 's verticals contain north polar,the result is right ,but when containing south polar, it returns a wrong result.
I have tested POLYGON((0 0,90 0,0 -90,0 0)), we expect to 1.57249 but returning 2.02365.
swanny

@awulkiew
Copy link
Member

What version of Boost are you using? develop and 1.64 seems to be fine.

My test:

typedef bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > point;
typedef bg::model::polygon<point> polygon;

polygon poly1, poly2;
bg::read_wkt("POLYGON((0 0,90 0,0 -90,0 0))", poly1);
bg::read_wkt("POLYGON((0 0,0 90,90 0,0 0))", poly2);

double a1 = bg::area(poly1);
double a2 = bg::area(poly2);

I'm getting 1.5707963267948963 in both cases. The same for float coordinate type.

@awulkiew
Copy link
Member

awulkiew commented Dec 14, 2017

I couldn't reproduce it so I'm going to close this issue. You didn't confirm or deny that the code above works for you so reopen this issue if needed. For now I'll assume that in recent versions of Boost the problem is fixed.

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

No branches or pull requests

2 participants