Opened 8 years ago

Last modified 8 years ago

#10421 closed Bugs

Wrong Pt/Box distance/comparable_distance results in spherical CS — at Initial Version

Reported by: awulkiew Owned by: Barend Gehrels
Milestone: Boost 1.57.0 Component: geometry
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

distance(Pt, Box) and comparable_distance(Pt, Box) returns invalid results in some cases, or at least not-corresponding to the Pt/Pt versions. E.g. for:

    point target(10.932501600000000, 59.922640600000001);
    point pt(10.7535660, 59.9131705);
    point pmin(10.187599199999999, 59.747306700000003);
    point pmax(10.753619700000000, 59.917844000000002);
    box bounding_box(pmin, pmax);

    bool target_inside_box = bg::covered_by(target, bounding_box);
    bool point_inside_box = bg::covered_by(pt, bounding_box);
    // the same for bg::comparable_distance()
    double dp = bg::distance(target, pt);
    double db = bg::distance(target, bounding_box);
    double dm = bg::distance(target, pmax);

The results are:

    target inside box = FALSE
    point inside box = TRUE
    target to point = 0.00157408
    target to box = 0.178946
    target to max = 0.00156704

Since the point lies inside the box and target outside the box the distance from target to box should be smaller than from target to point.

This bug affects the R-tree and is related with this ticket: boost::geometry::index::rtree does not work properly spherical_equatorial.

Change History (3)

by awulkiew, 8 years ago

Isolated failing test case.

by awulkiew, 8 years ago

Attachment: test_boost_geo2_index.cc added

The R-tree test exposing the bug.

by awulkiew, 8 years ago

Attachment: test_boost_geo2_data.h added

The file containing data required by the R-tree test. The original ~30k named Points trimmed to fit the trac requirements.

Note: See TracTickets for help on using tickets.