Fix intersection geometry in cases where two road edges intersect at

multiple points. This was already handled when the roads went between
the same intersections, but I found a case in Ballard where the roads
are just really close to each other. Screenshot diff empty in Krakow,
but still related to #243
This commit is contained in:
Dustin Carlino 2020-08-24 10:25:08 -07:00
parent b41b52d7bd
commit 0ee6bcbfcb
2 changed files with 35 additions and 28 deletions

View File

@ -20,11 +20,11 @@ data/input/raw_maps/south_seattle.bin,f054b9154cedcbfdbbcbdb0cab0c54c3,https://w
data/input/raw_maps/udistrict.bin,71003936f3489e55c3b680ea97b120c1,https://www.dropbox.com/s/l5991cxq2arndw6/udistrict.bin.zip?dl=0
data/input/raw_maps/west_seattle.bin,7ca4cbfa182c3f323ea5fa949a01ba25,https://www.dropbox.com/s/ix59akxeu3dg6lp/west_seattle.bin.zip?dl=0
data/input/raw_maps/xian.bin,45d3dff4d99821f387e550950fb5669d,https://www.dropbox.com/s/kjeu0q8ey93l11h/xian.bin.zip?dl=0
data/input/screenshots/downtown.zip,99255cbf2fd218343d3bbcda27de88d3,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0
data/input/screenshots/krakow_center.zip,17f614c811d8e805cb6d0220380d2796,https://www.dropbox.com/s/azea6v6mnxbe0vc/krakow_center.zip.zip?dl=0
data/input/screenshots/lakeslice.zip,e4d1e838ec52ef1b7fdfaced614bea03,https://www.dropbox.com/s/06mwgdt6orow3rk/lakeslice.zip.zip?dl=0
data/input/screenshots/montlake.zip,b7cd8c868967cf1be0e5e7250de2ffc2,https://www.dropbox.com/s/eblgq5zj3gflhwx/montlake.zip.zip?dl=0
data/input/screenshots/udistrict.zip,b5ba0f28899f6ad6351f6b00ead0863c,https://www.dropbox.com/s/ecnt1tyza48y9o2/udistrict.zip.zip?dl=0
data/input/screenshots/downtown.zip,49e04dd25f6380f82eee2ddaac3afdc6,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0
data/input/screenshots/krakow_center.zip,8c2fb2957b2590a72f8d26f0e07dfbc7,https://www.dropbox.com/s/azea6v6mnxbe0vc/krakow_center.zip.zip?dl=0
data/input/screenshots/lakeslice.zip,ba80ca2ba87473cafb63df67a7312559,https://www.dropbox.com/s/06mwgdt6orow3rk/lakeslice.zip.zip?dl=0
data/input/screenshots/montlake.zip,43f215c846999c9ef6e93f269a347922,https://www.dropbox.com/s/eblgq5zj3gflhwx/montlake.zip.zip?dl=0
data/input/screenshots/udistrict.zip,b4569face9a710ad74565f3b198d0519,https://www.dropbox.com/s/ecnt1tyza48y9o2/udistrict.zip.zip?dl=0
data/input/seattle/N47W122.hgt,0db4e23e51f7680538b0bbbc72208e07,https://www.dropbox.com/s/mmb4mgutwotijdw/N47W122.hgt.zip?dl=0
data/input/seattle/blockface.bin,add872bab9040ae911366328a230f8b5,https://www.dropbox.com/s/rxd2care60tbe75/blockface.bin.zip?dl=0
data/input/seattle/blockface.kml,350bd9e59bf2af4e885a7c0741e6ee6b,https://www.dropbox.com/s/ukknmpjdvilncq9/blockface.kml.zip?dl=0
@ -62,25 +62,25 @@ data/input/xian/osm/china-latest.osm.pbf,0108807f1dc321d5de5579622ac3f4cf,https:
data/input/xian/osm/xian.osm,4084c665ad947bb40173a43cb33fdec8,https://www.dropbox.com/s/j5qwt33bs077sd2/xian.osm.zip?dl=0
data/input/xian/service_roads.bin,2130675f49282a5e9fe3db870b089e98,https://www.dropbox.com/s/5djufzeqgdp43ek/service_roads.bin.zip?dl=0
data/system/cities/seattle.bin,4c23d8a7fbf0981a65c7e9499a1c7185,https://www.dropbox.com/s/1vg3138khp81kyi/seattle.bin.zip?dl=0
data/system/maps/ballard.bin,6d34ffdcfa4618b6d2f84ad93b0ad7e7,https://www.dropbox.com/s/5jinpev9hhre865/ballard.bin.zip?dl=0
data/system/maps/berlin_center.bin,1c37df4bd060143ccdebe81f6b2895c4,https://www.dropbox.com/s/6e01arzi037p4hy/berlin_center.bin.zip?dl=0
data/system/maps/downtown.bin,9500607291b64f5db79fe51d6fe73186,https://www.dropbox.com/s/3ryv0x148k0loke/downtown.bin.zip?dl=0
data/system/maps/huge_seattle.bin,6afd6bee521509f9d608159585625565,https://www.dropbox.com/s/vpu8h66irt43vuc/huge_seattle.bin.zip?dl=0
data/system/maps/krakow_center.bin,bc40feae4986e6248ac3b63af009bee8,https://www.dropbox.com/s/jks6hjeffskm1bf/krakow_center.bin.zip?dl=0
data/system/maps/lakeslice.bin,3f113845e0d9b3556f23edaedb70212c,https://www.dropbox.com/s/ruhvk53409vr0so/lakeslice.bin.zip?dl=0
data/system/maps/montlake.bin,4b4794a9ce303f88e9b697cd1daf1509,https://www.dropbox.com/s/enhgio9kj7vj3l0/montlake.bin.zip?dl=0
data/system/maps/south_seattle.bin,48d0f26ffcb375dbb24ad87ffda9eb61,https://www.dropbox.com/s/ylppm7xh9s210jo/south_seattle.bin.zip?dl=0
data/system/maps/udistrict.bin,afdf06224ffd306dc333f3745b1196f2,https://www.dropbox.com/s/tew4vb1qxuf3ff6/udistrict.bin.zip?dl=0
data/system/maps/west_seattle.bin,fdf4402b0a2a0be739e9374f8b8a564f,https://www.dropbox.com/s/ml7t4ehcm95i25u/west_seattle.bin.zip?dl=0
data/system/maps/xian.bin,0c47fde8a3661887505e5ff19f619de6,https://www.dropbox.com/s/vocx5j4k5in80n7/xian.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,6f5a5b9076fb4f47c3e2d9870c020167,https://www.dropbox.com/s/tzzxxu4575wnapl/weekday.bin.zip?dl=0
data/system/maps/ballard.bin,1f7c1a15881097942eddb57d4fd5a61e,https://www.dropbox.com/s/2rzhki2jadmd7qb/ballard.bin.zip?dl=0
data/system/maps/berlin_center.bin,e45d431c2868df901e4c8ec147d93776,https://www.dropbox.com/s/8w6v1vlyv7g2ejy/berlin_center.bin.zip?dl=0
data/system/maps/downtown.bin,4f8ce80348200409a404467dc52daf3a,https://www.dropbox.com/s/egc9p40el6gk6do/downtown.bin.zip?dl=0
data/system/maps/huge_seattle.bin,3b6084ecfe32ae8aee35995e6ba15b67,https://www.dropbox.com/s/hlijtpq5zefypx8/huge_seattle.bin.zip?dl=0
data/system/maps/krakow_center.bin,3ca833ed0e4df596c14db274a01f581a,https://www.dropbox.com/s/e2l89t96g2kc3xh/krakow_center.bin.zip?dl=0
data/system/maps/lakeslice.bin,439f9009c286c7a0d568f13a2ca4a655,https://www.dropbox.com/s/q4nidj3ugljbthf/lakeslice.bin.zip?dl=0
data/system/maps/montlake.bin,245c07cc5d476e30d85984a25170909c,https://www.dropbox.com/s/5suhix6ijajjzkz/montlake.bin.zip?dl=0
data/system/maps/south_seattle.bin,24c28a88f4a01c574be8a323e6d9042e,https://www.dropbox.com/s/1mofx7ltpqvlfa8/south_seattle.bin.zip?dl=0
data/system/maps/udistrict.bin,362c9896a62282cb09238eb19b4a2b2e,https://www.dropbox.com/s/e3q6i9ghau6ujsw/udistrict.bin.zip?dl=0
data/system/maps/west_seattle.bin,532a0e52654f49e2993fad1e46407008,https://www.dropbox.com/s/sqcckbo6q4n8kk2/west_seattle.bin.zip?dl=0
data/system/maps/xian.bin,391bdbc73e457ccd56cbca1e0bd27117,https://www.dropbox.com/s/7zfgtykexik6sae/xian.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,28377bb41c42603ca5144a464589168c,https://www.dropbox.com/s/kf98m2pywhmhcpx/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/car vs bike contention.bin,8002ad9207bda6a2fc20594f413a8c2e,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,c483c6734087c76630cdf652882dc440,https://www.dropbox.com/s/rvhek1pbwnf7t2e/weekday.bin.zip?dl=0
data/system/scenarios/ballard/weekday.bin,8fba0bf4e623552d75c27e9c210ce469,https://www.dropbox.com/s/62pwtz3pn098v84/weekday.bin.zip?dl=0
data/system/scenarios/downtown/weekday.bin,d789b5b7fe2a536f65ae330abb575823,https://www.dropbox.com/s/2ia9ssy9gza86sw/weekday.bin.zip?dl=0
data/system/scenarios/huge_seattle/weekday.bin,9892f03c2998b3661384f086dbc6c4bb,https://www.dropbox.com/s/hk3sr90owfr3hzc/weekday.bin.zip?dl=0
data/system/scenarios/lakeslice/weekday.bin,6f4a4c8b976b93704398e944bece92da,https://www.dropbox.com/s/e6qec5upp06kw1s/weekday.bin.zip?dl=0
data/system/scenarios/montlake/weekday.bin,b5517f6dd4dd8dc39719a54537e0bab9,https://www.dropbox.com/s/pq1wjy1sihp0b5u/weekday.bin.zip?dl=0
data/system/scenarios/south_seattle/weekday.bin,1a49ff2f0629105ab2a1298fe32ac3d4,https://www.dropbox.com/s/2bs00g1w9xeyx3e/weekday.bin.zip?dl=0
data/system/scenarios/udistrict/weekday.bin,2fed03d12b2833c2b3e1f702badd4dde,https://www.dropbox.com/s/575kjedo59o372j/weekday.bin.zip?dl=0
data/system/scenarios/west_seattle/weekday.bin,787147afc60160897ec2e6914f5a83b8,https://www.dropbox.com/s/vj525vlvdiy75m5/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,3ca244d01513b77491524c4f5506b760,https://www.dropbox.com/s/el3xme9pfwfcjcx/weekday.bin.zip?dl=0
data/system/scenarios/ballard/weekday.bin,68bfa6a4828250d3509f53c24c7767f7,https://www.dropbox.com/s/xnrf5xo1oe8y53e/weekday.bin.zip?dl=0
data/system/scenarios/downtown/weekday.bin,1de35fb4dcc7f90ff24cb02254308710,https://www.dropbox.com/s/4wjd20sz6cvcanx/weekday.bin.zip?dl=0
data/system/scenarios/huge_seattle/weekday.bin,0765fb9e626f8a4c77cc4e8281a7ae76,https://www.dropbox.com/s/r26nvsn2egldaaw/weekday.bin.zip?dl=0
data/system/scenarios/lakeslice/weekday.bin,9ae00a032bf902b46cf17de3116cc2af,https://www.dropbox.com/s/5puors5ws44z0xi/weekday.bin.zip?dl=0
data/system/scenarios/montlake/weekday.bin,cb408b3f41df6808ac0b7122550c4fb5,https://www.dropbox.com/s/nrthv95stqpf77m/weekday.bin.zip?dl=0
data/system/scenarios/south_seattle/weekday.bin,aa7eaef969cc5da7098c067e341d91a1,https://www.dropbox.com/s/nk4munephhyjmep/weekday.bin.zip?dl=0
data/system/scenarios/udistrict/weekday.bin,c8662112d4e9d90721579b8c293f759f,https://www.dropbox.com/s/ledmh55kkjruit8/weekday.bin.zip?dl=0
data/system/scenarios/west_seattle/weekday.bin,b2e50cd156a8c7bc08f48c60d42a336b,https://www.dropbox.com/s/0n2p2u18xkk42y7/weekday.bin.zip?dl=0

View File

@ -141,7 +141,12 @@ fn generalized_trim_back(
));
}
if let Some((hit, angle)) = use_pl1.intersection(&use_pl2) {
// Sometimes two road PLs may hit at multiple points because they're thick and close
// together. pl1.intersection(pl2) returns the "first" hit from pl1's
// perspective, so reverse it, ensuring we find the hit closest to the
// intersection we're working on.
// TODO I hoped this would subsume the second_half() hack above, but it sadly doesn't.
if let Some((hit, angle)) = use_pl1.reversed().intersection(&use_pl2) {
// Find where the perpendicular hits the original road line
let perp = Line::must_new(
hit,
@ -199,7 +204,9 @@ fn generalized_trim_back(
// Include collisions between polylines of adjacent roads, so the polygon doesn't cover area
// not originally covered by the thick road bands.
// It's apparently safe to always take the second_half here.
// Always take the second_half here to handle roads that intersect at multiple points.
// TODO Should maybe do reversed() to fwd_pl here too. And why not make all the lines
// passed in point AWAY from the intersection instead?
if fwd_pl.length() >= EPSILON_DIST * 3.0 && adj_fwd_pl.length() >= EPSILON_DIST * 3.0 {
if let Some((hit, _)) = fwd_pl.second_half().intersection(&adj_fwd_pl.second_half()) {
endpoints.push(hit);