physics – Targeting a ballistic pistol

ballistic

I'm trying to determine the elevation angle of a gun that fires ballistic projectiles.

For a target located at a certain distance D, I will have to calculate an angle which increases with D.

Incidentally, this relationship is non-linear, as the projectile loses its speed of movement as it moves.

In the past, I did that with a search table … for a lot of test shots, see where the projectile hit the ground.

But this only works if there is no delta in the altitude between the gun and the target.

A target located at the top of a hill will require adjustment to increase range. While a target in a valley below would mean a lower cannon elevation.

This means that the table search decomposes and that a 2D table looks like a kludge.

What would be an effective way to calculate this targeting? I know things also depend on the speed of the nozzles and the drag, but they will be fixed and not variable. I will not model the wind either.