I have figured out how to calculate target lead all by myself. I am doing this as a template for something I am coding in the game Stormworks. In the game, you would receive only the azimuth and the distance to the target with a radar. This translates that data to calculate how much you must lead the target to hit it whilst the target moves.
space to shoot