mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-27 15:03:20 +03:00
Format with rustfmt 1.4.38-stable.
Rename 'pair1' to 'pair'.
This commit is contained in:
parent
a319c77db1
commit
5eadce28f2
@ -160,17 +160,21 @@ impl DrawIntersection {
|
||||
if let Some(ring) = i.polygon.get_outer_ring() {
|
||||
// Turn each road into the left and right point that should be on the ring, so we can
|
||||
// "subtract" them out.
|
||||
let road_pairs = i.roads.iter().map(|r| {
|
||||
let road = map.get_r(*r);
|
||||
let half_width = road.get_half_width();
|
||||
let left = road.center_pts.must_shift_left(half_width);
|
||||
let right = road.center_pts.must_shift_right(half_width);
|
||||
if road.src_i == i.id {
|
||||
(left.first_pt(), right.first_pt())
|
||||
} else {
|
||||
(left.last_pt(), right.last_pt())
|
||||
}
|
||||
}).collect::<Vec<_>>();
|
||||
let road_pairs = i
|
||||
.roads
|
||||
.iter()
|
||||
.map(|r| {
|
||||
let road = map.get_r(*r);
|
||||
let half_width = road.get_half_width();
|
||||
let left = road.center_pts.must_shift_left(half_width);
|
||||
let right = road.center_pts.must_shift_right(half_width);
|
||||
if road.src_i == i.id {
|
||||
(left.first_pt(), right.first_pt())
|
||||
} else {
|
||||
(left.last_pt(), right.last_pt())
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Walk along each line segment on the ring. If it's not one of our road pairs, add it
|
||||
// as a potential segment.
|
||||
@ -181,7 +185,7 @@ impl DrawIntersection {
|
||||
.iter()
|
||||
.any(|road_pair| approx_eq(window, &road_pair))
|
||||
})
|
||||
.map(|pair1| PolyLine::must_new(vec![pair1[0], pair1[1]]))
|
||||
.map(|pair| PolyLine::must_new(vec![pair[0], pair[1]]))
|
||||
.collect::<Vec<_>>()
|
||||
|
||||
// TODO We could merge adjacent segments, to get nicer corners
|
||||
|
Loading…
Reference in New Issue
Block a user