# Angle needed to launch a projectile to a given destination at a different height with given initial velocity

I need to calculate the angle required to launch a projectile from point A to point B on an uneven ground, given the parameters. 0nly gravity acts on the projectile – no air resistance.

Parameters given:

$d$ : range or distance

$v_{i}$ : initial velocity

$g$ : gravity

$y_{0}$ : launch height

Parameter to calculate:

$\theta$ : launch angle

I have found this formula to get distance travelled by the projectile

$d=\frac{ v_{i}cos\theta }{ g }( v_{i}sin\theta + \sqrt{ (v_{i}sin\theta)^{2}+2gy_{0} })$

From the above formula, I rearranged variables to get the initial velocity for a given angle. Like this:

$v_{i}^{2}=\frac{d^{2}g}{2(cos\theta)^{2}(y_{0}+d*tan\theta)}$

In the same way, I was trying to get that formula in terms of the angle. Like

$\theta=...$

But the far I got was

$y_{0}(cos\theta)^{2}+d*sin\theta*cos\theta=\frac{d^{2}g}{2v_{i}^{2}}$

From that point on, I could not resolve the equation.

I am looking for a formula to set the 4 parameters above and get the angle (or if it exists or not, or if the projectile will reach point B with the initial velocity or not) to launch the projectile. I would like to know if what I am triying to do is possible or projectile motion doesnt work this way.

I also found this one, to calculate the maximum range for angle.

$\theta=arccos(\sqrt{\frac{2gy_{0}+v^{2}}{2gy_{0}+2v^{2}}})$

It is almost what I am looking for but it doesnt take into account the distance.

-