canvas icon indicating copy to clipboard operation
canvas copied to clipboard

Bug found in path intersection code

Open mangofeet opened this issue 1 year ago • 2 comments

Reporting per instructions in output

The paths were generated by https://github.com/mangofeet/netrunner-alt-gen at commit fb98744 ("commit here for testing")

Here are two examples, the first one fails, the second is working fine.

  % ./netrunner-alt-gen techcircle pennyshaver -f none
generating Pennyshaver
M0 0A44.5 44.5 0 0 1 -0.33169625196116925 5.423185781529063
M0 0A44.5 44.5 0 0 1 -1.8462887729044937 8.328070468156096
M0 0A44.5 44.5 0 0 1 -5.869749004274205 11.77289516793639
M0 0A44.5 44.5 0 0 1 -12.215828912691428 11.79668885594982
M0 0A44.5 44.5 0 0 1 -10.485180808483543 5.0011747015629595
M0 0A44.5 44.5 0 0 1 -5.260255955428912 1.3603946882867177
M0 0A44.5 44.5 0 0 1 -16.98200058851249 0
M0 0A44.5 44.5 0 0 1 -15.74543676391246 -6.361569389849677
M0 0A44.5 44.5 0 0 1 -3.7683203435490533 -2.737844988736157
M0 0A44.5 44.5 0 0 1 -9.316082871853606 -10.346558226666499
M0 0A44.5 44.5 0 0 1 -2.6754947867415666 -4.728921026054774
M0 0A44.5 44.5 0 0 1 -3.181824758968915 -8.741991677928727
M0 0A44.5 44.5 0 0 1 -1.1525042458008272 -6.887093801914424
M0 0A44.5 44.5 0 0 1 1.1525042458008272 -14.643954906455996
M0 0A44.5 44.5 0 0 1 5.8573195457104745 -13.4709127039835
M0 0A44.5 44.5 0 0 1 13.739433015193747 -13.501703220792251
M0 0A44.5 44.5 0 0 1 9.830151008692457 -4.583874696173375
M0 0A44.5 44.5 0 0 1 16.855419331298737 -2.0695852614278465
M0 0A44.5 44.5 0 0 1 14.995617535259518 3.738827371466428
M0 0A44.5 44.5 0 0 1 12.812516868552287 8.642151750025768
M0 0A44.5 44.5 0 0 1 9.418399037705548 13.204108467608869
M0 0A44.5 44.5 0 0 1 3.0287713598120405 8.796190729159104
M0 0A44.5 44.5 0 0 1 1.1337545515164464 9.23368983184289
M0 0A44.5 44.5 0 0 1 0.006777565540588171 0.7766320864591075
M0 0A67.195 67.195 0 0 1 -3.2887573875471503 20.76439693702459
M0 0A67.195 67.195 0 0 1 -14.762930632152688 25.062482867374992
M0 0A67.195 67.195 0 0 1 -10.601843339691612 9.216041811599219
M0 0A67.195 67.195 0 0 1 -9.085119432116489 5.351544325073725
M0 0A67.195 67.195 0 0 1 -9.810432509647757 3.8644321358636375
M0 0A67.195 67.195 0 0 1 -9.13430282046598 2.1088199693541014
M0 0A67.195 67.195 0 0 1 -6.9948992986336975 0.7351935415433246
M0 0A67.195 67.195 0 0 1 -16.338125024071548 -1.1424729960678093
M0 0A67.195 67.195 0 0 1 -25.720058196281613 -10.91751697576698
M0 0A67.195 67.195 0 0 1 -15.122844457019305 -14.603961135296927
M0 0A67.195 67.195 0 0 1 -10.241929514824989 -19.674563543677277
M0 0A67.195 67.195 0 0 1 -2.9206561468182812 -13.740606847754604
M0 0A67.195 67.195 0 0 1 0.45918071298083873 -17.535403967648296
M0 0A67.195 67.195 0 0 1 4.982031019995716 -16.81905485310009
M0 0A67.195 67.195 0 0 1 10.672976783225394 -16.75321772153873
M0 0A67.195 67.195 0 0 1 9.343337408561574 -8.866496135586566
M0 0A67.195 67.195 0 0 1 14.038704103029207 -8.435304437690874
M0 0A67.195 67.195 0 0 1 6.566271794453787 -2.520555586158274
M0 0A67.195 67.195 0 0 1 19.591682486471335 -3.2785232635808725
M0 0A67.195 67.195 0 0 1 19.694166574676537 2.5927862174583822
M0 0A67.195 67.195 0 0 1 7.733726054713458 2.738656030838598
M0 0A67.195 67.195 0 0 1 16.032005497757098 9.63300074763557
M0 0A67.195 67.195 0 0 1 18.107282264478684 22.76397367160908
M0 0A67.195 67.195 0 0 1 4.804555386043063 13.200407433672396
M0 0A67.195 67.195 0 0 1 1.740281411159259 10.399511640890783
M0 0A67.195 67.195 0 0 1 0.2556972617251603 5.856430133928884
M0 0A103.4803 103.4803 0 0 1 -2.6521933850044235 23.278002588819454
M0 0A103.4803 103.4803 0 0 1 -13.071835210299767 31.55820184981186
M0 0A103.4803 103.4803 0 0 1 -7.336974169340024 10.286058423323169
M0 0A103.4803 103.4803 0 0 1 -25.583092796724472 22.634008542741327
M0 0A103.4803 103.4803 0 0 1 -40.434530199353446 14.716965429102501
M0 0A103.4803 103.4803 0 0 1 -41.18434667220025 -2.5189425516576307
M0 0A103.4803 103.4803 0 0 1 -32.57118927361477 -15.18819499350252
M0 0A103.4803 103.4803 0 0 1 -24.36345957648072 -23.941905045837338
M0 0A103.4803 103.4803 0 0 1 -11.53679710369667 -20.39121984739222
M0 0A103.4803 103.4803 0 0 1 -8.163144210469582 -36.82156400678477
M0 0A103.4803 103.4803 0 0 1 7.471999171456616 -42.37581305728043
M0 0A103.4803 103.4803 0 0 1 11.179164137089359 -20.58945903788056
M0 0A103.4803 103.4803 0 0 1 22.490100148357257 -23.28918046380973
M0 0A103.4803 103.4803 0 0 1 15.296926030082666 -9.558580254622669
M0 0A103.4803 103.4803 0 0 1 13.289182816525326 -5.640923433620415
M0 0A103.4803 103.4803 0 0 1 24.67098788742241 -5.243980358353269
M0 0A103.4803 103.4803 0 0 1 16.2373232362347 -0.14170097315844998
M0 0A103.4803 103.4803 0 0 1 38.14435695109357 10.220749640850002
M0 0A103.4803 103.4803 0 0 1 30.3179226685845 22.434082650476356
M0 0A103.4803 103.4803 0 0 1 22.161845408927704 36.883504605102424
M0 0A103.4803 103.4803 0 0 1 5.385681331511719 26.471469463688663
M0 0A103.4803 103.4803 0 0 1 0.2520728098983085 7.21842082998422
rendering output to output/30014-system-gateway-014-pennyshaver.png
Path: len=7 data=M11.125 0A55.625 55.625 0 0 1 47.133999705743754 0A55.625 55.625 0 0 1 -64.11600029425625 6.812097820257143e-15L-5.857000588512491 -1.3624195640514285e-15A33.375 33.375 0 0 0 24.883999705743754 -1.3624195640514285e-15A33.375 33.375 0 0 0 -41.866000294256246 -5.449678256205714e-15z
Intersection 0: seg=(1,3) t=(0,0.6457457275) pos=(-26.49550015,1.533438145e-15) dir=(270°,360°) tangent
Intersection 1: seg=(1,6) t=(0,0.2900586904) pos=(-26.49550015,-3.868951718e-15) dir=(270°,5.892388558e-15°) tangent
Intersection 2: seg=(1,5) t=(0.1987559297,0.5722297666) pos=(-15.99951249,-32.51942296) dir=(305.7760673°,166.998642°)
Intersection 3: seg=(3,5) t=(0.3819152425,1) pos=(-41.86600029,3.690125031e-15) dir=(360°,90.00000001°) tangent
Intersection 4: seg=(3,6) t=(0.3819152425,0) pos=(-41.86600029,-5.449678256e-15) dir=(360°,5.892388558e-15°) tangent
Intersection 5: seg=(3,4) t=(0.6909576212,0) pos=(-23.86150044,1.163852734e-15) dir=(360°,89.99999999°) tangent
Intersection 6: seg=(4,6) t=(0,0.3397652385) pos=(-23.86150044,-3.598067024e-15) dir=(89.99999999°,5.892388558e-15°) tangent
Intersection 7: seg=(3,6) t=(1,0.679530477) pos=(-5.857000589,-1.362419564e-15) dir=(360°,5.892388558e-15°) tangent
panic: Bug found in path intersection code, please report on GitHub at https://github.com/tdewolff/canvas/issues with the path or paths that caused this panic.
 % ./netrunner-alt-gen techcircle buzzsaw -f none    
generating Buzzsaw
M0 0A44.5 44.5 0 0 1 -4.169303476869075 18.806512647461126
M0 0A44.5 44.5 0 0 1 -6.241718804336401 9.79753598358987
M0 0A44.5 44.5 0 0 1 -11.83897771879452 9.93408183735652
M0 0A44.5 44.5 0 0 1 -14.522656093821599 5.285814540635748
M0 0A44.5 44.5 0 0 1 -16.979414147568693 -0.296376776388918
M0 0A44.5 44.5 0 0 1 -10.255445790723657 -3.531233172341416
M0 0A44.5 44.5 0 0 1 -9.68711075796362 -6.41175874039957
M0 0A44.5 44.5 0 0 1 -9.343503678329956 -11.334576319913364
M0 0A44.5 44.5 0 0 1 -2.114642396688211 -4.150219383126878
M0 0A44.5 44.5 0 0 1 -3.8472271349042657 -18.09978061687311
M0 0A44.5 44.5 0 0 1 1.321840180718155 -10.76552435418521
M0 0A44.5 44.5 0 0 1 5.440019540320883 -12.815882904192408
M0 0A44.5 44.5 0 0 1 4.153563959047602 -5.613219531699954
M0 0A44.5 44.5 0 0 1 4.389949529835782 -4.389949529835786
M0 0A44.5 44.5 0 0 1 11.094846173204473 -7.0681965451823885
M0 0A44.5 44.5 0 0 1 5.833918283016654 -2.1233726041594494
M0 0A44.5 44.5 0 0 1 5.304528639566168 -1.175985687228433
M0 0A44.5 44.5 0 0 1 6.961333694290274 -0.5478688435163761
M0 0A44.5 44.5 0 0 1 13.751256249685161 2.177985024865663
M0 0A44.5 44.5 0 0 1 12.405187477329893 6.320758725449167
M0 0A44.5 44.5 0 0 1 11.58169655194591 12.419848991307546
M0 0A44.5 44.5 0 0 1 2.914632586134786 5.481626641504516
M0 0A44.5 44.5 0 0 1 2.3309264047678013 6.582333109810937
M0 0A44.5 44.5 0 0 1 1.5163007301364573 11.51744750706216
M0 0A70.5325 70.5325 0 0 1 -6.0978550088232595 28.688152277743878
M0 0A70.5325 70.5325 0 0 1 -12.850440031722599 19.414897053364296
M0 0A70.5325 70.5325 0 0 1 -9.136686838982293 8.226709781302503
M0 0A70.5325 70.5325 0 0 1 -11.528105209571248 7.064431958185324
M0 0A70.5325 70.5325 0 0 1 -22.323663447177037 6.612570370045553
M0 0A70.5325 70.5325 0 0 1 -15.968403299149339 0.13935414442119054
M0 0A70.5325 70.5325 0 0 1 -7.291877497177836 -1.1549199363056033
M0 0A70.5325 70.5325 0 0 1 -16.254881578296995 -5.597004578161155
M0 0A70.5325 70.5325 0 0 1 -19.817421556485304 -14.398199556196772
M0 0A70.5325 70.5325 0 0 1 -9.078117874767209 -11.61946100987069
M0 0A70.5325 70.5325 0 0 1 -8.909804252311474 -21.510170264019855
M0 0A70.5325 70.5325 0 0 1 -1.7110810656123903 -12.174974406803237
M0 0A70.5325 70.5325 0 0 1 0.42907621943543006 -12.287135297428986
M0 0A70.5325 70.5325 0 0 1 8.31764694683212 -25.599085076301208
M0 0A70.5325 70.5325 0 0 1 10.104909534355286 -13.90821479108341
M0 0A70.5325 70.5325 0 0 1 21.775882413228288 -15.821104658054352
M0 0A70.5325 70.5325 0 0 1 27.346773795056727 -6.565379517561851
M0 0A70.5325 70.5325 0 0 1 30.020792071338818 5.564024930590122
M0 0A70.5325 70.5325 0 0 1 17.778173760046148 10.894478891844926
M0 0A70.5325 70.5325 0 0 1 18.05677399038015 23.111616773388693
M0 0A70.5325 70.5325 0 0 1 4.056374129366802 10.297705647544174
M0 0A70.5325 70.5325 0 0 1 3.0819348000372173 20.621707263356438
M0 0A109.67803749999999 109.67803749999999 0 0 1 -4.792408614057848 32.06675479451925
M0 0A109.67803749999999 109.67803749999999 0 0 1 -15.042640254212444 30.84198310070714
M0 0A109.67803749999999 109.67803749999999 0 0 1 -8.3363225950891 10.480193841398197
M0 0A109.67803749999999 109.67803749999999 0 0 1 -18.5979281414142 16.45405689510511
M0 0A109.67803749999999 109.67803749999999 0 0 1 -9.735770185487873 6.083584406143956
M0 0A109.67803749999999 109.67803749999999 0 0 1 -32.2454115594925 11.736369999318612
M0 0A109.67803749999999 109.67803749999999 0 0 1 -28.578309293421963 1.7479242758566045
M0 0A109.67803749999999 109.67803749999999 0 0 1 -36.95932364871578 -9.214994351769036
M0 0A109.67803749999999 109.67803749999999 0 0 1 -32.944007271590706 -22.641788897797383
M0 0A109.67803749999999 109.67803749999999 0 0 1 -13.373129908118386 -16.222903826884
M0 0A109.67803749999999 109.67803749999999 0 0 1 -17.400504886505445 -44.17375511362356
M0 0A109.67803749999999 109.67803749999999 0 0 1 -0.749490876666286 -28.62190183706196
M0 0A109.67803749999999 109.67803749999999 0 0 1 8.118043898883798 -31.390146648776785
M0 0A109.67803749999999 109.67803749999999 0 0 1 16.940914676818863 -27.645060196871746
M0 0A109.67803749999999 109.67803749999999 0 0 1 24.283310652727955 -21.4840584415289
M0 0A109.67803749999999 109.67803749999999 0 0 1 42.577515383367036 -16.343976856841763
M0 0A109.67803749999999 109.67803749999999 0 0 1 17.157425122974878 -1.3503186418937219
M0 0A109.67803749999999 109.67803749999999 0 0 1 15.264232586089362 1.0673791215094752
M0 0A109.67803749999999 109.67803749999999 0 0 1 22.24786551933876 5.547015877460396
M0 0A109.67803749999999 109.67803749999999 0 0 1 28.493792571905566 15.47086708123149
M0 0A109.67803749999999 109.67803749999999 0 0 1 16.769174963948757 15.637508635964181
M0 0A109.67803749999999 109.67803749999999 0 0 1 14.94878133139403 22.16247972875668
M0 0A109.67803749999999 109.67803749999999 0 0 1 10.28793469248724 30.747395713117516
M0 0A109.67803749999999 109.67803749999999 0 0 1 1.6662558348362921 19.045391341960222
rendering output to output/30005-system-gateway-005-buzzsaw.png
done

mangofeet avatar May 06 '24 16:05 mangofeet

As I continue to tweak, different one will fail or succeed... I'll try to get a smaller example of a fail/success and send that here

EDIT: original post edited with more manageable data EDIT2: I realize now that the extra path data is kinof useless... it gets translated before being put into the context...

mangofeet avatar May 06 '24 19:05 mangofeet

Thanks I will look into it, looks like an issue with parallel sections of self-intersecting paths, a known problem.

tdewolff avatar May 12 '24 20:05 tdewolff