
Hi Brian, On 28-2-2012 15:48, Brian Ahr wrote:
Hi Folks.
I was looking at the implementation of the huiller algorithm in boost, and it seems to be partially incorrect. See boost/geometry/strategies/spherical/area_huiller.hpp
(...)The comments at the top of the C++ file state that the code was derived from code in Graphics Gems 4, though the code was later corrected in Graphics Gems 5.
The comments also say: "The version in Gems didn't account for polygons crossing the 180 meridian. This version works for (...) for 180 meridian crossing polygons ... " So the same bug is apparently corrected (but probably differently).
I noticed this when trying to calculate areas of polygons on a sphere, where one of the points was (0, 0). In that case, it would always return a negative area, even though the polygon was defined counter-clockwise. Using a point other than (0,0) seemed to alleviate the problem, which got me wondering what was going on.
I cannot reproduce your problem. When I'm doing what you describe, also using (0,0), I get the correct results. Can you send me a problem-causing polygon? (preferrably in WKT format). Thanks, Barend