Opened 11 years ago

Closed 8 years ago

#6443 closed Bugs (fixed)

Convex hull does not cover polygon with zero area

Reported by: cooperch@… Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.47.0 Severity: Showstopper
Keywords: Cc:

Description

A polygon with points (0,0) and (0,2) should have an area of 0 and a perimeter of 4, I think? (If I'm wrong on the specification please let me know).

The attached code says otherwise - it gives a convex hull with zero perimeter.

Attachments (1)

boost_geom_test_no_multipoint.cpp (1.3 KB ) - added by cooperch@… 11 years ago.
c++ code to reproduce problem

Download all attachments as: .zip

Change History (6)

by cooperch@…, 11 years ago

c++ code to reproduce problem

comment:1 by viboes, 10 years ago

Component: Nonegeometry
Owner: set to Barend Gehrels

Please set the component in the future if you want it to be analyzed.

comment:2 by Barend Gehrels, 10 years ago

Thanks for the report - because the component was not set, it did not reach my inbox. However, will now have a look at the problem soon.

in reply to:  2 comment:3 by Sarat Chandra Addepalli <s.addepalli@…>, 10 years ago

Hi. This seems to me to be more of a question on convention followed, than a bug. If a point set S has only two elements (p1 and p2, say) Should the Convex_hull(S) have two edges or one? One edge would mean that the Convex_hull is not a 'closed' polygon. Two edges, on the other hand, would mean that the perimeter calculation is correct.

On a side note, I had to include the #include<boost/geometry/geometries/point_xy.hpp> line to avoid compilation errors in the attached file.

comment:4 by Rong Xiao <akelux@…>, 9 years ago

I think this IS a bug according to the mathematical definition of a convex hull of a set of points, c.f. http://en.wikipedia.org/wiki/Convex_hull. The convex hull one point is the point itself; the convex hull of two distinct points are the line segment between the two points.

comment:5 by awulkiew, 8 years ago

Resolution: fixed
Status: newclosed

This was fixed in 1.57 as a side effect of fixing https://svn.boost.org/trac/boost/ticket/10562. Since 1.57 a Polygon containing the minimal correct number of Points is returned (3 for open and 4 for closed Polygons) so "correct" area and perimeter can be calculated. Note that according to OGC specification Polygons with area = 0 are invalid.

Note: See TracTickets for help on using tickets.