1
$\begingroup$

How can I compute programatically the distance between a point and a quadric (a surface defined by a quadratic polynomial, for example a sphere, a cone, or a hyperboloid)?

How can compute that distance after applying transformation/rotation to the quaternion?

  • 0
    The (most efficient) method highly depends on which quadric surface you're considering. Please specify what particular quadrics are you dealing with...2011-07-27

1 Answers 1

2

Basically you have an optimization problem, e.g. for a point (x0,y0,z0) and a sphere with radius r and center (0,0,0) you have:

x² + y² + z² = r (x - x0)² + (y - y0)² + (z - z0)² -> Min 

This can be simplified to one equation with two variables by eliminating z:

(x - x0)² + (y - y0)² + (sqrt(r² - x² - y²) - z0)² -> Min 

This can be solved using various approaches by approximation, or exactly by using e.g. Lagrange multipliers.