# Calculate stroke force and angle for a ball rolling on a surface to reach a destination position (optimal golf putt)

I'm trying to find an algorithm which calculates the optimal golf putt (angle, force) given a 3D surface (obtained through Poisson reconstruction), start and destination position (hole). I guess that this is a problem that's been solved before but I'm having a hard time finding a good entry into this subject.

I found similar ideas in potential field pathfinding algorithms but I have the feeling that there must be a much simpler solution which I'm missing?

So before I try to reinvent the wheel here, I'm asking for any input on this subject which can help get things going - or in this case balls rolling quicker!

you can use this equation to estimate your velocity $$v_0$$ to hit the ball to get the position $$r_L$$
For example $$\alpha=30$$ and $$r_L=200 [m]$$ you get
$$v_0\approx 172 \quad[km/h]$$
\begin{align*} &\ddot{r}=0\quad \Rightarrow\quad \dot{r}=\dot{r}_0\quad ,r=\dot{r}_0\,t+r_0\\ &\ddot{z}=-g\quad \Rightarrow\quad \dot{z}=-g\,t+\dot{z}_0\quad ,z=-\frac{g\,t^2}{2}+\dot{z}_0\,t+z_0\\\\ &\text{with }\\ & \dot{r}_0=v_0\,\cos{\alpha}\quad, r_0=0\\ &\dot{z}_0=v_0\,\sin{\alpha}\quad, z_0=0\\ &\text{we get:}\\ &r=v_0\,\cos{\alpha}\,t&(1)\\ &z=v_0\,\sin{\alpha}\,t-\frac{g\,t^2}{2}&(2)\\ &\text{we solve equation (1) and (2) for t and z:}\\ &z=\frac{1}{2}\,{\frac {r \left( 2\,\sin \left( \alpha \right) {{\it v_0}}^{2}\cos \left( \alpha \right) -g\,r \right) }{{{\it v_0}}^{2} \left( \cos \left( \alpha \right) \right) ^{2}}}&(3)\\ &\text{we can now solve equation (3) with z=0 and r=r_L and obtain }\\ &\boxed{v_0^2=\frac{g}{2}\frac{r_L}{\cos(\alpha)\,\sin(\alpha)}= g\,\frac{r_L}{\sin(2\,\alpha)}} \end{align*}