Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#6019 closed Bugs (fixed)

Convex hull and Area, combined, sometimes give wrong result

Reported by: Crispin Cooper <cooperch@…> Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.47.0 Severity: Problem
Keywords: convex hull area Cc:

Description

Attached is a program which calculates convex hull from a number of points. The three points actually on the hull are

(0,0) (0,105) (0,103)

making the hull a triangle with area 1407.5. However, the program (msvc compiler) returns 1406, with the points inserted in the order shown in the cpp file.

If all points except the three listed above are removed from the program, the answer returns to 1407.5.

Probably this is just me being stupid. In any case thank you very much for your help!

Attachments (1)

boost_geom_test.cpp (1.1 KB) - added by Crispin Cooper <cooperch@…> 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by Crispin Cooper <cooperch@…>

Attachment: boost_geom_test.cpp added

comment:1 Changed 6 years ago by Barend Gehrels

Resolution: worksforme
Status: newclosed

I've the opinion the program is changed in between. It now gives 5406, which is correct or at least near the correct value (but it still might be that you expect 5407.5).

Can you make your comment and the program consistent?

comment:2 Changed 6 years ago by Barend Gehrels

Resolution: worksforme
Status: closedreopened

comment:3 Changed 6 years ago by anonymous

Sorry, "1407.5" and "1406" were typos which I managed to copy to the bug report - should have read 5407.5 and 5406 respectively.

The correct answer is 5407.5.

The answer the program gives is 5406.

The answer the program gives if all except the three points on the hull are deleted, is 5407.5.

comment:4 Changed 6 years ago by Crispin

I don't know whether it might work if run as a multi point instead, now that bug has been fixed. The list of points in the example is certainly an odd shape for a polygon, I don't know what assumptions the polygon model is built on?

comment:5 Changed 6 years ago by Barend Gehrels

Resolution: fixed
Status: reopenedclosed

OK, thanks for answering. There was indeed a problem if there were multiple left-most points, which was the case here. Fixed now. Thanks for your report.

comment:6 Changed 6 years ago by Barend Gehrels

To be complete, also in this test the next include should be added.

#include <boost/geometry/geometries/point_xy.hpp>

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Barend Gehrels.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.