Solving for distance and angle