Skip to content

Commit

Permalink
set bound so that some curves ARE closer
Browse files Browse the repository at this point in the history
  • Loading branch information
afabri committed Dec 27, 2024
1 parent 3699067 commit 3273aed
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Frechet_distance/examples/Frechet_distance/Frechet_DS_3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ int main(int argc, char* argv[])
CGAL::FrechetDistanceNearNeighborsDS<Curve, Traits> ds;
ds.insert(curves);

double distance = 10;
for(const Curve& c : curves){
std::pair<double, double> res = CGAL::approximate_Frechet_distance(c, query, 0.000001);
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
}
double distance = 16;
std::vector<std::size_t> result = ds.get_close_curves(query, distance);

std::cout << result.size() << "curves at Frechet distance closer than " << distance << std::endl;
std::cout << result.size() << " curves at Frechet distance closer than " << distance << std::endl;
return 0;
}
2 changes: 2 additions & 0 deletions Frechet_distance/examples/Frechet_distance/data/0.wkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LINESTRING(0.085839906829580856 1.4654135690584429 0.60776214492765934,1.018745798556133 2.2250924964496042 0.71378454996098395,3.6040791315465546 3.0242041697601612 1.1547740951697341,4.1225363635817587 4.7147357358025541 2.629851378843036,5.6449068325965284 6.2710686711296058 6.4139932599746352,6.1062678545943037 6.6051531233366072 6.3362513120524877,7.895349172776962 9.0728171038737671 7.1725986194923017,7.79666750593013 8.9990883409169591 9.0183692436644129,9.7585906028830607 10.705188889713712 9.1341292431770622,11.05316151676079 11.856880441596658 10.41669938237697,13.177073825712244 13.147554655003745 12.296062750155095,14.246308254878151 14.523409873300725 14.106724696021907,13.336656497359979 15.107837292036233 14.480008746316683,13.506115294643633 15.748109908332619 17.408553724730758,13.380534844242417 17.999310718072387 16.17359818541318,13.945184305260909 19.175541920838246 17.901506526108587,15.869778858991621 21.164110205839982 18.400060584757497,16.268721528527685 23.234933191787718 19.119324867614342,15.610329308188387 22.696661840417939 18.887964760745504,17.256638275458279 23.815888726767486 20.744680665889579,17.701209835220784 24.961191350404807 22.513630226741807,18.299059333584474 26.485235596763122 22.592252107224542,18.82708933304988 26.907201646629954 21.98277786654107,20.460153558071138 27.215989424005052 22.957984412580153,22.085124214648818 28.730690643282042 24.789483328154265,22.957093084786568 29.11465732801452 25.648949814972756,21.763558320641128 28.173337905318675 24.892281370084739,21.467137444759203 29.630630457938793 24.672909931032986,21.975526124507997 32.23479910546844 25.166684601629694,23.934296363515209 31.908456538366174 25.856438839857312,23.699267692131453 32.382619195576517 27.921465871692082,22.4537511419814 33.853108811798066 29.172641681549532,22.681356199575568 32.844972341405061 30.176806061326289,22.993015677792624 34.035023802923305 31.105151375657329,26.075328236509815 34.599397607413742 30.666005171687683,27.308386561953025 35.790243697459012 33.368118635562823,29.394031181641978 37.157977040938533 36.183940307316668,28.84863921102227 37.23754500045586 35.879816292493246,29.341886466919771 36.350865511775055 37.603267676960186,30.052996960691367 35.360985255331158 37.162354478706959,31.460564962376619 37.39662655903868 40.652934903597135,36.248586168186151 38.870994333899368 40.228275016197635,34.476926003235448 40.202639210043124 40.105846104230579,34.936961565001859 40.342800441048126 40.833410321620399,37.322735865025798 41.487391672069649 41.532950525106529,36.976385986352241 40.268585326855749 41.830255297355265,37.906468670288426 43.539502225085663 42.91911442836863,40.184030034618402 43.824218992157583 42.294358043473309,39.929378243716322 43.846607878417181 46.023211326782416,39.861575560724617 45.897277702539725 45.74384320636306,42.072620477461136 47.32249971220579 46.438356977275774,43.019629193485073 47.406966541370281 47.939124277066959,43.428150669042061 46.763719923319002 47.187424749180224,44.652514962080815 49.785177628448729 48.325289287287681,45.498285138137966 51.091544528111513 50.952978825702225,46.783482389910979 51.48247108417263 53.286551749560779,48.340865759911075 54.419403663102194 54.397451178987623,47.749056018674423 53.552116460127259 57.421263323969086,50.989821455692706 54.236474978640075 57.731433245764634,53.88969903560757 53.762859744293571 57.424821124682289,55.689135512083915 54.249873084576102 58.302831221834921,56.410993482072968 55.688719998014719 61.007553452209315,57.476985704222272 57.525840429274631 59.185047879512823,58.37762211675669 57.429641077893898 58.521781769091511,58.176919442162806 57.995280604982845 60.646994413469244,57.410755715785271 59.035101545355587 60.914532360821767,57.984780693114722 61.338014228422985 62.526475623139227,60.723398232790288 62.094201900437497 62.50753568883276,61.426503132580002 63.409447729090083 63.681349714848572,61.016798638676626 64.516766096312878 64.914390861669574,65.289514887470716 67.906394584140486 64.698824574157086,65.902372891803978 66.960412044809104 64.930905456004552,67.28776475289493 69.519045988342057 64.983096466937866,67.372962827169687 67.644360404089042 65.771630770229493,66.947197543092713 67.951638022855249 65.63171175861163,67.78884836421075 66.648657187660532 64.724552939603342,71.470624439626491 65.969183933801887 64.298731687612303,74.652936650622081 70.745771253814411 63.774087685455491,74.866906633274766 72.039826191387164 67.021394623182772,74.340829985573166 72.617205312152777 69.031933472063045,75.731760586296204 73.065643422131018 69.857963618192187,74.745599268603996 73.704737702821063 70.511659881180549,75.902086850909626 73.930862555999539 72.124659960489225,78.08162435705313 75.129905930374093 73.581943291408194,78.971307384888263 76.13001564139293 73.636897552672281,80.175518374432613 76.972997684667902 77.358016354282057,83.016723376026462 78.474598202991359 77.276239033732239,82.291622619423734 81.023084042006886 78.593838040830406,83.738805788862777 79.72023455818271 80.799508066856035,85.059067658538837 79.276674668443889 81.051395136824254,86.053885443935158 80.344881506307004 81.50646892236378,86.556517640268083 81.01731091463806 82.561389047848223,89.102812509012651 78.680654941427377 83.085464456490129,89.780933752400742 80.065447128020608 83.32073272081557,87.943066785780573 81.491841256848957 86.322277695298439,86.525206695202229 83.614817674656607 86.549896796723957,87.178247377759519 83.246049610741466 86.838725202455194,89.547493578549762 85.003501425325481 89.782107399977065,91.681353502279734 86.57431410793393 92.628921037979282,92.76995429806577 88.650698737770099 92.683832182912681,93.373255834208805 88.744047767479742 94.48341886841186,92.310954933434473 90.7611032126227 94.599433960405818,94.509824393239739 92.737232897973342 97.393718094684047,96.024674499202206 91.693580565624131 97.482306635658119,94.826390876489882 92.019816770547976 99.591585544902756,96.134704957235215 92.111207213395602 98.174677721069386,96.505734608539882 91.529679019200131 97.371359225485335,97.176963197692274 94.031584666138841 98.317178210374763,94.462866830983884 95.427261413878185 98.478484468191454,95.8758158686218 98.528334000024756 95.850701056954918,96.107381415873363 99.945323190257511 94.759926388512184,98.721124606662968 100.55791642775158 96.860485570108608,98.064369588884375 101.57431858782965 99.249498592894355,98.882919798251791 100.47937601930725 98.753452618922296)

2 changes: 2 additions & 0 deletions Frechet_distance/examples/Frechet_distance/data/1.wkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LINESTRING(0.085839906829580856 1.4654135690584429 0.60776214492765934,1.3883706433465663 2.8168597801246866 0.47664411352491154,2.1886236037023177 3.6123298548975846 1.9750561371844553,4.4866117527682068 3.2362329483256524 2.8116292291313507,7.3832285326934333 3.2695682508693187 2.7293220838626051,8.5874864545707847 5.3672689985002346 3.7319788613682361,11.264493155340032 7.4811011758367201 5.8253920384793272,12.926995703846602 11.50705020628663 6.5579268368724888,11.254738801237984 14.557620394807255 6.9629175766286151,12.349637156167587 17.196099633976782 5.8799801732520116,11.654228815944499 16.011177440385129 5.8476029962189608,13.164649824757289 17.601802262686373 7.2067594293460804,12.264388050652018 15.503971644597822 8.2774190903535771,12.608443586962661 17.040376614876607 10.189958804441229,13.762311386061665 18.970687247255981 11.487933590790817,15.426816372435637 18.988642876822372 12.254438752809921,16.647446741661209 20.997430035666856 12.742575228917978,18.281069675556747 21.575931400093122 13.58977041139141,20.30587896699307 19.911444616695274 12.90435638489422,19.294330530882895 17.816226824221076 13.022612612692489,21.196948845764222 18.410094722650708 14.279739719216897,23.532578287315665 21.10762302796784 15.189860404072915,26.193952513952766 22.177224220246558 15.101242713097216,26.290174638318259 21.188570785351406 14.946668703243466,26.690944697856256 23.179345712376897 18.183669483759246,25.790126717380698 24.649438553679897 17.83096236285445,27.310477417934148 25.416094666120827 16.450784789252662,29.386888323126662 25.541633207115101 16.756714479367041,28.843756481777557 25.604976214045703 18.312972052270432,29.468434324503288 26.963041795772618 19.783470462377927,32.064292845160423 27.448360040686349 18.863555300478478,34.288065925047924 27.931571240524029 21.312525478429066,35.620573947609181 28.697907226826185 22.76593414068925,38.989426291129163 32.342630065108352 23.856129616361862,39.997348751816773 34.651477667859112 23.75677027376431,41.215515916064916 35.495600104232963 25.164850948659129,40.915782339746805 34.312230860499099 23.46997248187045,40.23316782024844 34.594859558137152 24.088823419227058,43.537077515697284 36.915056934564518 23.838104967982943,44.727876925368442 37.234337161623998 24.46843197853082,45.697817269348455 38.890643086597642 25.027395949481601,47.802212397001206 38.24149606429696 26.03563673055255,51.881639309133497 39.387381870759711 28.898815589140575,52.673459642275937 41.016950989361419 29.824997436430078,53.122327230512418 40.866292634618681 31.384389203074896,52.694581203773787 42.616426710981095 33.795262308854582,53.882119221750791 43.135075545317235 35.38541756195589,54.190994099319546 45.256227294937553 34.004589652476227,54.444939432258536 43.521053839963294 33.061010573180859,56.894415323130495 45.551839602187869 33.125686269910631,55.580958690405986 42.534907863171355 33.419142109598205,59.390273412345373 43.987149275870586 33.691698137733866,60.601880165659075 42.826189665848801 34.30517776622694,61.325181708151554 43.608824056809887 36.333225724424047,62.374912292863094 45.388739601606268 36.438341757524057,64.127933553933914 48.390423081787851 36.177147381977221,63.529330900482236 50.959349693821295 36.928400199273639,65.926131446480909 51.18502349624513 39.819959448425564,66.656283013434859 52.357161331306827 42.85409287659644,66.762493126225749 51.994574983494296 43.270959406159577,67.92945630457713 50.832963861574456 45.099671579606031,67.805964722522276 53.250430917396422 42.987133183235422,67.340700259313039 51.904930375328092 42.913034876962286,68.227529533399917 52.541815458853904 43.583644037329869,68.576244386893364 53.675129486245488 43.272547182803827,70.041403080356147 55.380205245909913 44.773096501756761,71.299193081418736 56.60102240107107 48.418691795307147,71.733976177811016 57.073544864213787 48.439105940842559,70.931621233817907 56.318424470299497 48.283669433642366,71.393559179542436 57.628005982827418 49.350154109760176,70.954790955261402 59.665624640341036 51.311390583751411,71.335926801627068 59.677119854607433 53.024346880830151,72.182687647858245 58.686814510936934 53.935972548050422,73.119089076612752 58.449717119760706 55.182768958739096,71.81913098797996 61.151390663715489 57.805103939316361,72.151783489021327 62.584310395256445 55.672205383776522,71.269013481055566 63.082016381529421 55.278432455921603,72.832896096751895 66.53870525950633 54.748833320663508,72.336177515794745 67.616086045234752 57.843284313713013,71.395994186653837 68.743136714179357 61.210972819770056,69.980862595392722 67.923088861062041 61.660284231370966,70.08327232774343 69.857160109084234 62.974441867138054,68.580753001449906 71.383064582520817 63.223641313575712,71.090400348237083 71.386127493958838 63.396041445542807,72.579916532341485 73.200765028960731 64.978570618659873,71.167414117773788 74.70786949869067 64.633970151483155,72.285580392145988 73.6123458413782 66.21418894328913,72.054393988392732 72.770601132440262 68.142155120716254,73.244957500325256 72.877612617506969 71.028687624443634,73.596840808188091 73.914916069402778 72.378275106425818,73.743151361501418 75.527393250822684 72.677661653813658,74.172125314981045 78.255730921961103 72.324899785547501,71.970514577145337 81.190844286491242 76.639026123936603,72.443664532061206 79.38967010214003 77.057115649784777,73.071574697268332 79.940435522060483 76.430321940585316,74.825004182487746 81.418028165179649 75.352451952058061,76.733959933691096 84.878829503488106 76.548694820461208,77.292924341104978 85.396802072382229 78.348528617520344,76.043051253945592 86.309100867240261 78.786035640462728,79.445223770788445 86.703094733153748 81.828524732013278,79.010360863671835 88.175272092624382 83.114472133488107,78.880599441447615 89.025037497675086 85.477710219611239,79.45967022587503 87.398136542163144 86.118588662941718,79.286520202644766 87.626576892628037 86.663026627358221,78.069172321824595 86.182096589462546 87.906685316579868,78.389638016804014 83.534844141219764 89.448117324483405,79.74371869866053 83.433640368813258 88.190305651074496,81.830268963869173 84.778415152350618 91.839600211575544,83.37651414221159 86.203163555801467 92.0280354067785,85.438322769572622 87.936439801107241 94.088996560474627,85.760602975344156 88.303345167297707 93.813101513405826,87.788645212876844 91.179119218761642 93.593093541306473,88.236439366745827 92.425712977148336 93.738740724673661,90.474109115827687 90.254864984196857 93.135044791250664,90.279384782940738 88.238402168094865 92.431818629291925,89.792529099224041 88.976966117220385 94.395106564711057,90.264253395792124 88.636908280867885 94.699972871997218,92.355955323353982 88.368161819918512 93.858508891235473,93.620988055437252 89.080164869468476 95.10440521453377,94.064852127850358 90.992327611984919 94.07891769491178,94.556999474719561 91.718430593312817 92.990987550113218,93.018251372796769 93.609904339169873 93.192494113036929,92.543016186791803 94.48487172116954 95.468436268076317,90.57805698780831 93.484761209060096 94.786833151419486,93.477589514544732 94.694355515702384 96.261971691992528,92.929746979286904 94.238958877850706 97.274807500651448,93.959473942578398 95.952319342374068 97.267781731363499,95.321060786969412 97.077363634231759 98.580633622914007,97.370171553497229 95.926652738490375 95.707703826261664,99.004713838869847 98.470695359730897 95.049888830916544,96.554042177065256 99.141804894150113 97.25997852517223,99.890915056229858 100.38733326316819 97.418031737359811,98.882919798251791 100.47937601930725 98.753452618922296)

Loading

0 comments on commit 3273aed

Please sign in to comment.