Sometimes when I see an awesome analysis on the internet, I just want to make it more awesomer. Really, this should be everyone’s goal on the internet—either make stuff or make it more awesome.
In this case, it’s a post from Singletrack (and also covered by Boing Boing) looking at a particular crossroad in the United Kingdom that leads to a large number of accidents between bicycles and cars. One in 2011, one in 2012, and another in 2016—all resulting from the seeming failure of the driver to yield to the cyclist.
In short, the problem comes about because of the angle of the intersection (it’s not perpendicular) and the angle of the blind spot in the car from its front pillar.
Here’s what I want to do. I want to make an animation in python that shows the motion of both the car and the location of the blind spot (they call it a pillar shadow) on the other road. Once I model the motion of the blind spot, I can also find its speed. Even better, after build a model it will be super trivial (which is way easier than trivial) to change the location of the blind spot or the angle of the intersection.
Before getting started, I need some details. According to the Singletack post, the two roads cross at 69°. Their post also shows an image of car with its pillar shadow. Using Tracker Video Analysis I can easily measure the angle between the front of the car and both the leading and trailing edge of the shadow (19.4° to 27.1°). Just to be clear, here is a basic diagram of that shadow. Note that this is in the UK, so the drivers are on the wrong side of the car.
Also, the original article assumes that the car will be driving at a speed of 37 mph (not sure where they got this but I will use the same value). Before jumping into python, let me draw a picture to help figure out how the calculation will work. Let me start with just the leading edge of the pillar shadow and its projection onto the other road.
I’m going to start my model in the simplest way—I’m just going to create the leading edge of the projection for this pillar shadow. But there’s still some math to do beforehand. Here’s how it will go down. If you want more details, I’ll try to add enough comments in the code so that you can figure it out.
- The two roads are lines. I can get the equations of these two lines in the form of y = mx + b (slope and intercept). Just for simplicity, both lines will pass through the origin (point x = 0, y = 0).
- Next, find the location of the car on the first road. I need the x and y coordinate of this car (this isn’t difficult).
- Find the equation of the line representing the leading edge of the pillar shadow. This is found using the point-slope formula for a line The slope of the line is found from the angle between the front of the car and the leading edge of the shadow.
- Now I need to find the intersection between the shadow line equation and the line equation for the second road. The x and y value for this intersection is the location of the shadow projection.
- Really, that’s it. The only thing left is to move the car a little bit forward and repeat the calculation to find the next location of the shadow projection.
Yes, it’s true. You don’t actually need a computer program to model the motion of this shadow. If you like you could find the velocity of the shadow projection with just some basic math and calculus—I just like this way better.
Now for the first model. Here is the animation of the leading edge of the projection. Click the “play” to run the code and the “pencil” to see or edit the code (don’t worry, your edits won’t break anything).
Right away you should be able to notice that the projection of the shadow on the road moves slower than the actual car—but don’t worry, we will get to the speeds soon. Let me make one more modification. The following is the same calculation except that it shows both the leading edge and the trailing edge of the pillar shadow.
Here you can see that as the car approaches the intersection, the projection of the pillar shadow onto the road gets smaller. I guess that should be obvious since the pillar shadow has a single angular width—but still, it’s nice to see how that would actually look. Also, this will have one important impact on bicycle speeds. The bike rider doesn’t have to travel at the speed of the leading or trailing shadow edge—the rider just needs to stay between these two spots in order to be invisible to the driver (which would be a bad thing).
I’m fairly certain that the leading and trailing shadow edges move at a constant speed—but I’m not absolutely certain. Just to be sure, I am going to make a plot of the position along the road for both edges and the car (all in their own dimension). Here is the code (just in case) and the plot.
From the slopes of these lines, I can find the shadow edge speeds. I get values of 5.50 m/s and 7.58 m/s (12.3 mph and 17.0 mph). That is clearly in the range of possible speeds for a human on a bicycle.
But now that you have code to calculate the speed of the pillar shadow, you can use this same thing for other intersections. What if it’s a 90 degree intersection? What if the car is moving faster? What if you have a bigger angle for the pillar shadow? All of these questions are pretty easy to answer by just changing some numbers in the code. And yes, I already pointed out that you can do this same calculation on paper—the python stuff is just fun (and you get an animation).