I need to know how to get the closest point on the surface of an ellipsoid to another point.
I had an idea, but apparently i was wrong, and oversimplfying.
What i did was squash the ellipsoid and point into local space, so the ellispoid is a unit circle
vector3 pointLocalCoord = ( pointOriginal - ellipsoid.origin ) / ellipsoid.radii
Then from there, the closest point should be 1, in the direction of the transformed point from the origin
vector3 closestPointOnEllipsoidLocal = norm ( pointLocalCoord )
Then get back into standard space
vector3 closestPointOnEllipsoidWorld = closestPointOnEllipsoidLocal * ellipsoid.radius + ellipsoid.origin
But of course, all of this seems not to work, i was curious if any body could point me in the direction of some pre-existing code or such; as some of the articles i've tried reading kinda go a bit out of my scope of knowledge.
Also, if that seems right to you, please do tell. I'm pretty sure its wrong though.
Edit: Sorry for the unresponsiveness with this and my other question. They're different, i was axperimenting with something else