Sign in to follow this  
Bobboau

distance from hermite curve

Recommended Posts

I'm tinkering with making a 2d platformer engine, I'd like to make the level out of Hermite splines, but I need a way to do collision detection, I don't need anything complex like spline on spline intersections, I just want a function for finding the point on the curve that is closest to an arbitrary point. I know calculus, so I know the standard method for doing this; take the line function make a distance function, take the derivative, wherever the derivative is 0 will be a (the) closest point. problem is in the last step I end up with something unwieldy and I can't solve the 0s. I'm hoping there is a standard solution for this. I'm defining the Hermite curve as: (start_pnt * 2.0f*t3 - 3.0f*t2 + 1.0f) + (end_pnt * -2.0f*t3 + 3.0f*t2) + (start_tan * t3 - 2.0f*t2 + t) + (end_tan * -t3 + t2) any help would be appreciated

Share this post


Link to post
Share on other sites

Have you considered converting your hermite curve in a set of lines and use them for the collision test?

Just an idea which may save lots of headache.

Best regards!

Share this post


Link to post
Share on other sites
just found [url=http://www.tinaja.com/glib/cmindist.pdf]this[/url] looks like I'm not the only person to try and fail at this, but this looks like I might get some good results.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this