Solving a cubic to find nearest point on a curve to a point
Ok, I have a projectile that has its position defined such that: a.x = initialX + initialDX * time; a.y = initialY + initialDY * time + 0.5 * gravtiy * time^2; I want to be able to predict which obstacles in my environment this projectile will collide with. I plan on checking the distance from A the closest point on the curve to the point P . I figure that at the point A the tangent to the curve will be perpendicular to the vector AP , and that the tangent to the curve at A will simply be the velocity V of the projectile at that point. AP dot V = 0 ap.x = initialX + initialDX * time - p.x; ap