Boost logo

Geometry :

Subject: [ggl] Incorrect polygon area and problem with the boost::geometry::correct
From: Barend Gehrels (barend)
Date: 2011-03-18 07:39:19


Hi Vishnu,

On 17-3-2011 16:57, Vishnu wrote:
> I have two problems with a slightly edited version of the example program
> 'c06_custom_polygon_example.cpp'. My revisions to the example are very
> minor, the substitution of a boost_array for holes with an std::vector, and
> a call to 'correct' the polygon prior to calculating the area. The
> differences between the example and my edited file are shown following the
> problem description below.
>
> 1) The polygon area is correct when I use boost-geometry 0.6 along with
> boost_1_43. The polygon area is wrong when I use boost-geometry 0.8 along
> with boost_1_46_1. The correct area of the polygon is 0.92. However, with
> boost geometry 0.8, I get an area of 1.08, so it appears that the areas of
> the holes are added instead of being subtracted.
I cannot reproduce your steps. It is right that without calling correct,
the polygon area is incorrect: holes (in the sample accidentally turned
clockwise) are added. That was already in 0.6 and it is still the case
in 0.8, it is by design.

I retrieved 0.6.0 from the sandbox-tags and it was already the case.

I will update the example such that the holes are in correct
orientation, thanks for the report.

> 2) My edited version of the program compiles and builds with MS Visual
> Studio 2008 with both versions of boost-geometry. However, on RHEL4 with g++
> 4.2.4, I can build it only with boost-geometry 0.6. The compilation error
> with g++ when I use boost-geometry 0.8 is shown below (the boost geometry
> files were put inside the boost_1_46_1 hierarchy). The program compiles if
> I do not call 'correct'.
I do not have g++ 4.2.4. Using gcc 4.4 it runs fine. Are you sure you
have defined the correct ring-types traits? There were changes between
0.6.0 and trunk.

In the diff output you sent some < > tags are missing, probably by the
HTML-parsing, so I cannot see exactly what you're doing there.

Regards, Barend

-- 
Barend Gehrels
http://about.me/barendgehrels

Geometry list run by mateusz at loskot.net