s2geometry icon indicating copy to clipboard operation
s2geometry copied to clipboard

problem with S2loop::init

Open catmagic opened this issue 6 months ago • 2 comments

Hi, the program crashes on the correct data, namely, a call on a very narrow quadrilateral causes a crash and the error: ERROR Edge 1 crosses edge 3. this is the quadrilateral -1.0780749761978428 1.4688488034282494 -1.0780759735047707 1.4666611693199976 -0.981471670584179 -3.0839249353037306 -0.9814705651439662 -3.081737300942303

catmagic avatar Dec 19 '23 11:12 catmagic

So edges 1 and 3 would be edges:

(-1.0780759735047707, 1.4666611693199976)-(-0.981471670584179, -3.0839249353037306) and 
(-0.9814705651439662, -3.081737300942303)-(-1.0780749761978428, 1.4688488034282494) 

which don't cross when I test them manually.

Can you print the individual S2Points that form the polygon with fprintf(stderr, "%.18e %.18e %.18e\n", pnt.x(), pnt.y(), pnt.z());? That'll give me full precision on the actual points in the polygon so I can check them.

smcallis avatar Dec 19 '23 15:12 smcallis

@catmagic Alternatively, can you add a test case to s2loop_test.cc that demonstrates the problem? Having runnable code will make this easier to debug.

jmr avatar Jan 10 '24 08:01 jmr