Last active
February 16, 2018 00:40
-
-
Save cipher982/6a66ea74fc22d9f51183ce7f6a6e4721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// estimate longitudinal position of a car (s) | |
check_car_s += ((double)prev_size * 0.02 * check_speed); | |
if (car_lane == lane) // if the other car is in 'lane' (our lane) | |
{ | |
// is it within 30m ahead of us? | |
car_ahead |= check_car_s > car_s && check_car_s - car_s < 30; | |
} | |
else if (car_lane - lane == -1) // if left of us | |
{ | |
// 30m front or back? | |
car_left |= car_s - 30 < check_car_s && car_s + 30 > check_car_s; | |
} | |
else if (car_lane - lane == 1) // if right of us | |
{ | |
// 30m front or back? | |
car_right |= car_s - 30 < check_car_s && car_s + 30 > check_car_s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment