Opened 5 years ago

Closed 5 years ago

#13040 closed Bugs (fixed)

Assertion `! op2.fraction.is_zero() && ! op2.fraction.is_one()' failed.

Reported by: Vissarion Fisikopoulos <fisikop@…> Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.64.0 Severity: Problem
Keywords: Cc:

Description

The following yields an assertion `! op2.fraction.is_zero() && ! op2.fraction.is_one()' failed.

#include <boost/geometry.hpp>

namespace bg = boost::geometry;

int main()
{

    typedef bg::model::point<double, 2,
                       bg::cs::geographic<bg::radian> > point;

    typedef bg::model::polygon<point, false> polygon;

    polygon polygon1;
    bg::model::multi_polygon<polygon> multi_polygon1;

    bg::read_wkt("MULTIPOLYGON(((0.069813170079773112509 0.087266462599716390636,0.73303828583761765358 0.78539816339744750184,0.26179938779914918578 1.1170107212763698001,-0.069813170079773112509 -1.3439035240356325129,0.31415926535897897853 1.2217304763960294967,1.3089969389957458734 -0.94247779607693704662,-1.0471975511965967431 0,-0.017453292519943278127 0.45378560551852520355,-1.0646508437165400629 -0.54105206811824158031,-0.68067840827778780532 -1.5184364492350652664,-0.33161255787892229829 0.95993108859688025536,0.69813170079773112509 -1.1693705988361995374,-0.19198621771937607328 -0.13962634015954622502,-1.0646508437165400629 -1.0646508437165400629,0 -0.38397243543875214655,1.5707963267948950037 -0.97738438111682357512,0.71558499331767444485 -1.3788101090755189304,0.13962634015954622502 0.78539816339744750184,1.1693705988361995374 1.5184364492350652664,-0.95993108859688025536 1.1693705988361995374,0.62831853071795795707 -1.3264502315156891932,-1.0297442586766534234 -0.9075712110370504071,-1.3264502315156891932 0.052359877559829834381,-0.20943951023931933753 0.50614548307835505181,-1.2566370614359159141 1.5533430342749516839,1.3089969389957458734 -0.76794487087750429311,-0.8028514559173908216 1.0646508437165400629,0.75049157835756097334 -0.19198621771937607328,1.0122909661567101036 -1.0471975511965967431,0.36651914291880882679 0.92502450355699372686,1.0646508437165400629 0,-1.5533430342749516839 -0.75049157835756097334,-0.33161255787892229829 1.3788101090755189304,-0.78539816339744750184 0.55850536063818490007,0.99483767363676689488 -0.4363323129985819393,-0.47123889803846852331 -1.2915436464758025537,0.78539816339744750184 0.71558499331767444485,-0.12217304763960294689 -0.57595865315812821983,-1.1344640137963131199 -1.4660765716752353072,1.1170107212763698001 -0.47123889803846852331,0.069813170079773112509 1.1868238913561428571,-0.017453292519943278127 -1.0122909661567101036,0.45378560551852520355 -0.8028514559173908216,0.69813170079773112509 -0.4363323129985819393,0.15707963267948948927 -0.034906585039886556254,0.052359877559829834381 -0.97738438111682357512,-0.4363323129985819393 -1.3788101090755189304,0.59341194567807142857 0.45378560551852520355,1.1868238913561428571 -1.4137166941154055699,-0.64577182323790127683 1.5184364492350652664,-1.2042771838760861769 1.5009831567151219467,1.4137166941154055699 -1.0471975511965967431,-1.3962634015954622502 1.5707963267948950037,-0.99483767363676689488 -1.5184364492350652664,0.19198621771937607328 1.2740903539558592339,-0.4014257279586954108 -0.55850536063818490007,1.1868238913561428571 -1.2217304763960294967,0.4014257279586954108 0.26179938779914918578,0.27925268031909245003 1.5707963267948950037,-1.2391837689159728164 1.3788101090755189304,-0.12217304763960294689 0.94247779607693704662,1.3788101090755189304 0.61086523819801474833,-1.3264502315156891932 -0.31415926535897897853,0.22689280275926260177 -1.2740903539558592339,0.54105206811824158031 -0.76794487087750429311,-0.13962634015954622502 1.0122909661567101036,-1.4311699866353488897 0.95993108859688025536,1.1344640137963131199 0.8028514559173908216,1.5358897417550085862 0.017453292519943278127,-1.2915436464758025537 0.12217304763960294689,-1.0646508437165400629 1.5009831567151219467,-0.26179938779914918578 -0.26179938779914918578,0.62831853071795795707 -0.57595865315812821983,-0.68067840827778780532 -1.5184364492350652664,0.48869219055841178756 -1.3613568165555756106,-1.0646508437165400629 -0.13962634015954622502,-0.052359877559829834381 1.4486232791552919874,-0.64577182323790127683 -0.29670597283903571428,0.27925268031909245003 1.0646508437165400629,-1.4660765716752353072 0.12217304763960294689,-0.4363323129985819393 1.2915436464758025537,1.1344640137963131199 -1.2915436464758025537,-0.052359877559829834381 0.8726646259971638786,0.9075712110370504071 0.78539816339744750184,-1.4311699866353488897 -0.48869219055841178756,-0.73303828583761765358 0.99483767363676689488,-0.54105206811824158031 -1.4137166941154055699,-0.71558499331767444485 0.59341194567807142857,0.36651914291880882679 0.19198621771937607328,0.8028514559173908216 0.62831853071795795707,-1.5184364492350652664 -0.4363323129985819393,-1.4835298641951786269 -0.34906585039886556254,0.45378560551852520355 -0.62831853071795795707,-0.48869219055841178756 -1.2566370614359159141,-1.2566370614359159141 0.54105206811824158031,-0.71558499331767444485 -1.0821041362364831606,0.38397243543875214655 1.0297442586766534234,1.5358897417550085862 -0.38397243543875214655,1.2391837689159728164 0.94247779607693704662,-0.71558499331767444485 -0.8028514559173908216,0.89011791851710719836 -1.3788101090755189304,-1.0995574287564264804 0,-1.3962634015954622502 1.2391837689159728164,-1.3089969389957458734 -0.20943951023931933753,-0.45378560551852520355 -0.27925268031909245003,0.57595865315812821983 0.31415926535897897853,-0.17453292519943278127 0.8377580409572773501,0.50614548307835505181 -0.13962634015954622502,-1.3264502315156891932 0.27925268031909245003,-0.95993108859688025536 -0.59341194567807142857,-0.34906585039886556254 -1.0995574287564264804,-0.50614548307835505181 -0.54105206811824158031,-0.85521133347722066986 -0.64577182323790127683,0.48869219055841178756 1.5707963267948950037,-0.45378560551852520355 0.76794487087750429311,0.62831853071795795707 0.13962634015954622502,1.2391837689159728164 0.59341194567807142857,0.034906585039886556254 1.4835298641951786269,1.3788101090755189304 -0.78539816339744750184,1.0122909661567101036 -1.1693705988361995374,0.69813170079773112509 1.1519173063162564397,-1.3788101090755189304 -0.27925268031909245003,-0.66322511575784459659 -1.0995574287564264804,1.1868238913561428571 0.20943951023931933753,1.5358897417550085862 -1.2042771838760861769,-0.66322511575784459659 -0.76794487087750429311,1.0821041362364831606 0,-1.1344640137963131199 0.50614548307835505181,-1.4660765716752353072 -1.3962634015954622502,-1.5184364492350652664 -1.5184364492350652664,0.017453292519943278127 -0.12217304763960294689,-0.59341194567807142857 -0.94247779607693704662,-1.1868238913561428571 0.69813170079773112509,-0.069813170079773112509 -0.54105206811824158031,-1.0995574287564264804 1.0122909661567101036,-0.61086523819801474833 0,0.45378560551852520355 -0.20943951023931933753,-0.8726646259971638786 0.017453292519943278127,0.017453292519943278127 -0.52359877559829837157,-0.50614548307835505181 1.1868238913561428571,0.59341194567807142857 0.26179938779914918578,-0.22689280275926260177 1.2566370614359159141,-0.15707963267948948927 1.2740903539558592339,-0.27925268031909245003 1.5358897417550085862,-1.5533430342749516839 -0.50614548307835505181,0.24434609527920589378 -1.0471975511965967431,0.36651914291880882679 0.76794487087750429311,-1.0122909661567101036 1.4137166941154055699,-0.50614548307835505181 -1.1868238913561428571,0.017453292519943278127 -0.4014257279586954108,-0.087266462599716390636 -0.62831853071795795707,-0.94247779607693704662 -0.087266462599716390636,-1.1868238913561428571 -1.4311699866353488897,1.0471975511965967431 -1.5184364492350652664,0.47123889803846852331 -1.2391837689159728164,0.10471975511965966876 0.8028514559173908216,0.26179938779914918578 -0.92502450355699372686,0.75049157835756097334 1.3089969389957458734,0.82030474843733403034 0.12217304763960294689,0.75049157835756097334 -0.48869219055841178756,-0.95993108859688025536 1.0297442586766534234,-0.99483767363676689488 1.3788101090755189304,0.069813170079773112509 0.087266462599716390636),(0.13962634015954622502 0.15707963267948948927,1.5533430342749516839 1.3439035240356325129,1.3439035240356325129 -0.59341194567807142857,-0.26179938779914918578 0.45378560551852520355,0.4363323129985819393 -0.17453292519943278127,-1.3439035240356325129 0.29670597283903571428,0.64577182323790127683 -1.1519173063162564397,-0.52359877559829837157 -0.36651914291880882679,-0.4363323129985819393 -0.95993108859688025536,-0.68067840827778780532 1.2042771838760861769,0.9075712110370504071 -1.3089969389957458734,0.45378560551852520355 0,-0.76794487087750429311 0,-1.5184364492350652664 -0.087266462599716390636,1.1519173063162564397 1.3788101090755189304,0.69813170079773112509 1.4137166941154055699,-0.4014257279586954108 0.97738438111682357512,-1.0646508437165400629 -0.97738438111682357512,-0.61086523819801474833 1.1693705988361995374,1.5533430342749516839 -0.55850536063818490007,0.8726646259971638786 0.52359877559829837157,-1.4311699866353488897 -0.8377580409572773501,0.13962634015954622502 0.15707963267948948927)))", multi_polygon1);

    bg::read_wkt("POLYGON((0.052359877559829834381 0.052359877559829834381,-0.052359877559829834381 0.55850536063818490007,-0.19198621771937607328 -1.4311699866353488897,0.68067840827778780532 -0.069813170079773112509,-0.22689280275926260177 0.45378560551852520355,0.85521133347722066986 0.47123889803846852331,1.1170107212763698001 -1.0297442586766534234,0.26179938779914918578 -1.1693705988361995374,-0.55850536063818490007 -1.0471975511965967431,0.69813170079773112509 -0.22689280275926260177,-1.3613568165555756106 0.4014257279586954108,0.41887902047863867505 0.47123889803846852331,-1.5184364492350652664 1.5707963267948950037,0.62831853071795795707 -0.55850536063818490007,-1.2740903539558592339 -0.20943951023931933753,0.29670597283903571428 1.5707963267948950037,-0.73303828583761765358 -0.68067840827778780532,-1.1693705988361995374 -0.82030474843733403034,-0.99483767363676689488 1.1693705988361995374,-1.3613568165555756106 0.66322511575784459659,0.50614548307835505181 -0.69813170079773112509,-1.0821041362364831606 -1.1170107212763698001,1.3962634015954622502 -0.27925268031909245003,0.99483767363676689488 1.0297442586766534234,-1.5533430342749516839 -1.3089969389957458734,0.59341194567807142857 -0.31415926535897897853,1.0646508437165400629 -0.71558499331767444485,0.19198621771937607328 0.45378560551852520355,1.4660765716752353072 -0.69813170079773112509,1.0471975511965967431 1.4835298641951786269,-1.2740903539558592339 -1.3788101090755189304,-1.4137166941154055699 -0.33161255787892229829,-0.94247779607693704662 -0.26179938779914918578,0.50614548307835505181 0.12217304763960294689,1.4137166941154055699 -0.95993108859688025536,0.10471975511965966876 0.73303828583761765358,0.78539816339744750184 -0.33161255787892229829,-0.34906585039886556254 -0.17453292519943278127,-0.64577182323790127683 -1.0122909661567101036,0.45378560551852520355 -0.9075712110370504071,1.2915436464758025537 0.59341194567807142857,1.3089969389957458734 0.034906585039886556254,0.54105206811824158031 0.94247779607693704662,0.33161255787892229829 -0.12217304763960294689,-0.27925268031909245003 0,0.8377580409572773501 1.0297442586766534234,0.61086523819801474833 -0.85521133347722066986,1.1170107212763698001 -0.20943951023931933753,1.5009831567151219467 0.73303828583761765358,-0.45378560551852520355 -0.76794487087750429311,0.8726646259971638786 1.1693705988361995374,-1.5533430342749516839 -0.4363323129985819393,-0.59341194567807142857 1.1170107212763698001,0.4363323129985819393 1.4137166941154055699,-0.66322511575784459659 -0.71558499331767444485,-0.8726646259971638786 0.61086523819801474833,-0.38397243543875214655 0.50614548307835505181,0.052359877559829834381 0.052359877559829834381))", polygon1);

    bg::union_(multi_polygon1, polygon1, multi_polygon1,
                    bg::strategy::intersection::geographic_segments<>
                    (bg::srs::spheroid<double>(6378388,6356911.946127946488559246063232421875)));

    return 0;
}

Produced on Ubuntu 14.04.3 with gcc 4.8.4

The assertion fails in the following branch: ​https://github.com/awulkiew/geometry/tree/fix/mkaravel_setops

The problem seems to be on computing intersection of segment (-62.999999999999936051, 57.999999999999943157) (-34.999999999999964473, 0) with segment (25.999999999999971578, 0) (-43.999999999999957367, 0)

Change History (3)

comment:1 by Vissarion Fisikopoulos <fisikop@…>, 5 years ago

The following also yields the same assertion (same branch, same system)

#include <iostream>
#include <string>

#include <boost/geometry.hpp>

namespace bg = boost::geometry;

int main()
{
    typedef bg::model::point<double, 2,
                       bg::cs::geographic<bg::radian> > point;

    typedef bg::model::polygon<point, false> polygon;

    polygon polygon1;
    bg::model::multi_polygon<polygon> multi_polygon1;

    bg::read_wkt("MULTIPOLYGON(((0.12217304763960294689 0.087266462599716390636,1.3962634015954622502 1.0646508437165400629,-1.2740903539558592339 0.45378560551852520355,0.78539816339744750184 1.5707963267948950037,-0.99483767363676689488 -1.1344640137963131199,-0.069813170079773112509 1.0995574287564264804,0.61086523819801474833 0.54105206811824158031,0.20943951023931933753 -0.95993108859688025536,-0.8377580409572773501 0.47123889803846852331,0.73303828583761765358 0.8726646259971638786,-0.36651914291880882679 -0.12217304763960294689,0.55850536063818490007 0.75049157835756097334,-1.2740903539558592339 -0.45378560551852520355,-0.20943951023931933753 -1.5184364492350652664,0.68067840827778780532 1.3264502315156891932,0.55850536063818490007 1.4311699866353488897,0.75049157835756097334 1.5707963267948950037,0.12217304763960294689 0.087266462599716390636),(0.15707963267948948927 0.10471975511965966876,-0.15707963267948948927 0.33161255787892229829,0.8726646259971638786 -0.38397243543875214655,0.15707963267948948927 0.10471975511965966876)))", multi_polygon1);

    bg::read_wkt("POLYGON((0.069813170079773112509 0.087266462599716390636,0.10471975511965966876 -1.5184364492350652664,1.1868238913561428571 0.82030474843733403034,-1.3613568165555756106 -1.1693705988361995374,0.069813170079773112509 0.087266462599716390636),(0.15707963267948948927 0.034906585039886556254,1.0646508437165400629 1.3089969389957458734,1.2915436464758025537 -1.3089969389957458734,1.2915436464758025537 -1.1868238913561428571,0.15707963267948948927 0.034906585039886556254))", polygon1);

    bg::union_(multi_polygon1, polygon1, multi_polygon1,
               bg::strategy::intersection::geographic_segments<>
               (bg::srs::spheroid<double>(6377397.1550000002608, 6356078.9628181885928)));
    return 0;
}

The problem seems to be on computing intersection of segment (0.78539816339744750184 1.5707963267948950037), (-0.99483767363676689488 -1.1344640137963131199) with segment (0.55850536063818490007 1.4311699866353488897), (0.75049157835756097334 1.5707963267948950037)

comment:2 by awulkiew, 5 years ago

This issue was fixed with a workaround directly in the problematic branch by choosing the operations differently and therefore avoiding the need for assertions.

https://github.com/awulkiew/geometry/commit/96fa987706195d64f155059f0750919025e35e94

comment:3 by awulkiew, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.