It might also help you to look at the problem in terms of 2D instead of 3D. Taking out the height/altitude component in your angle calculations reduces the problem to simple trigonometry.