fix center lines for two-ways

This commit is contained in:
Dustin Carlino 2018-06-19 10:26:27 -07:00
parent 52b8570e6c
commit 592f284be3
5 changed files with 9 additions and 5 deletions

View File

@ -46,12 +46,12 @@
- multiple lanes
- display + mouseover parking lane and sidewalk
- make the center lines in geom layer work (use debug mode to verify)
- something broke curved roads
- make extra lanes for oneways work
- have to switch from Centered to DrivingDirection somehow
- either translate points up-front and be normal or fix geom layer (for turns and intersections)
- dont allow cars on non-driving lanes :)
- model cars parking
- maybe render numbers on the cars to distinguish them
- document the FSM (on lane driving, waiting, turning, parking, etc)

View File

@ -20,6 +20,7 @@
- and maybe to recalculate fixedish things if they change?
- more advanced road modeling, like https://wiki.openstreetmap.org/wiki/Proposed_features/Street_area
- yellow center lines eat into the width of one lane arbitrarily
## Conga line idea

View File

@ -174,6 +174,8 @@ impl SelectionState {
draw_map.get_t(turn.id).draw_full(g, render::TURN_COLOR);
},
}
// TODO tmp
draw_map.get_r(id).draw_debug(g, geom_map.get_r(id));
}
SelectionState::TooltipRoad(id) => {
canvas.draw_mouse_tooltip(g, &draw_map.get_r(id).tooltip_lines(map, geom_map));

View File

@ -25,8 +25,8 @@ const BIG_ARROW_TIP_LENGTH: f64 = 1.0;
const TURN_ICON_ARROW_TIP_LENGTH: f64 = BIG_ARROW_TIP_LENGTH * 0.8;
const TURN_ICON_ARROW_LENGTH: f64 = 2.0;
pub const DEBUG_COLOR: Color = canvas::PURPLE;
pub const BRIGHT_DEBUG_COLOR: Color = [1.0, 0.1, 0.55, 1.0];
pub const DEBUG_COLOR: Color = canvas::RED;
pub const BRIGHT_DEBUG_COLOR: Color = [0.8, 0.1, 0.1, 1.0];
pub const ROAD_COLOR: Color = canvas::BLACK;
pub const PARKING_COLOR: Color = canvas::PURPLE;
pub const SIDEWALK_COLOR: Color = canvas::GREEN;

View File

@ -41,6 +41,7 @@ impl GeomRoad {
pts[num_pts - 1] = Pt2D::from(new_last_pt);
// TODO handle offset
let offset = road.offset as f64;
let lane_center_shift = if road.one_way_road {
0.0
} else if road.use_yellow_center_lines {
@ -48,9 +49,9 @@ impl GeomRoad {
// shouldn't match either lane. Needs to be its own thing, or adjust the bbox.
(LANE_THICKNESS / 2.0) + (BIG_ARROW_THICKNESS / 2.0)
} else {
(LANE_THICKNESS / 2.0)
LANE_THICKNESS * (offset + 0.5)
};
// TODO when drawing cars along these lines, do we have the line overlap problem?
// TODO when drawing cars along these lines, do we have the line overlap problem? yes.
let lane_center_lines: Vec<(Pt2D, Pt2D)> = pts.windows(2)
.map(|pair| {
geometry::shift_line_perpendicularly_in_driving_direction(