Distance Point Quadrics

Hi,
I am looking for a library to compute the distance between a point and a quadrics!
Thank you!
What is a quadrics?
These look like two approaches to the (presumed) problem:
http://math.stackexchange.com/questions/202069/minimal-distance-from-origin-to-quadric-surface
https://www.researchgate.net/publication/239813070_ON_THE_DISTANCE_FROM_A_POINT_TO_A_QUADRIC_SURFACE

There might not be easy-to-get canned solution. The first link requires "Solve four equations in four variables", for which there should be several libraries.
sqrt((x1-x2)^2 + (y1-y2)^2)
It's pretty easy to set up the function for the two points, create another function to get a point out of a quadratic at given x value and plug it in. Using an elipses you could get as many terms for the quadratic as you need. I'm on a phone so I won't try to create a working example...

Edit:
Thank you SakurasouBusters, I was in the hallway waiting to be called in for jury duty sellections, so I was in a bit of a rush. I did assume 2D cartesian. I should have read keskiverto's links first, looks like I was wrong about what wss being asked.
Last edited on
sqrt((x1-x2) + (y1-y2))

I think the correct formula for calculating the distance of two points is :
sqrt((x1-x2) * (x1-x2) + (y1-y2) * (y1-y2))
Euclidean distance between two known 2D points.
The OP did not specify the dimension.
https://en.wikipedia.org/wiki/Euclidean_distance
Thank you for your replies, but the problem is not to compute the distance, it's more finding the closest point on the quadric surface.
closed account (48T7M4Gy)
If you want to find the closest point then you will need to define the perpendicular distance from the (single) point to the (or a one of many nearby) tangent planes on the surface.

That is a complex geometry problem in multidimension space involving analysis of the curvature of the surface and the proximity to the point. How quadrics would simplify this is anybody's guess.

Maybe do it by trial and error - rapidly assess distances within a cone shaped ray set?

Google "distance to a surface c++ libraries" there are many reputable entries.

Good luck with it, what's your vector calculus like?

Thank you for your replies, but the problem is not to compute the distance, it's more finding the closest point on the quadric surface.

I know. The two links on my first comment are about finding the point.
Topic archived. No new replies allowed.