Results 1 to 4 of 4

Thread: Closest Point on a 3D Quadratic Surface

  1. #1
    Newbie
    Joined
    Feb 2010
    From
    Midlands
    Posts
    3

    Closest Point on a 3D Quadratic Surface

    Hi All, first post, hope I'm obeying all the rules

    If I have a 3d quadratic surface defined by $\displaystyle ax^2+by^2+cz^2+d=0$ and a point in space defined by the position vector $\displaystyle p={px,py,pz}$ , how can I determine the closest point on the surface to p?

    I suspect the solution lies down the path of minimising the value of the difference between the points, or finding the values of x, y and z that minimise $\displaystyle apx^2+bpy^2+cpz^2-ax^2-by^2-cz^2$, but my maths is rusty and I have a feeling that if this is possible it would involve implicit differentiation or one of the other techniques I never quite mastered the first time around.

    Any help or even a pointer to a different (easier) approach would be much appreciated.

    Thanks,
    Dave.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Nov 2009
    Posts
    202
    the closest point will obviously be the point which lies perpendicular to the surface ie. at an angle of 90 degrees. i did this problem somewhere but i forgot the technique. u can assume a point O(x,y,z) on the surface and then carry out calculations keeping in mind the facts:OP is perpendicular to the surface and O satisfies the surface equation. there is also a shortcut involving dot product and cross product which i dont remember well. hope this helps!!!
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor

    Joined
    Apr 2005
    Posts
    19,801
    Thanks
    3035
    Quote Originally Posted by davesymm View Post
    Hi All, first post, hope I'm obeying all the rules

    If I have a 3d quadratic surface defined by $\displaystyle ax^2+by^2+cz^2+d=0$ and a point in space defined by the position vector $\displaystyle p={px,py,pz}$ , how can I determine the closest point on the surface to p?

    I suspect the solution lies down the path of minimising the value of the difference between the points, or finding the values of x, y and z that minimise $\displaystyle apx^2+bpy^2+cpz^2-ax^2-by^2-cz^2$, but my maths is rusty and I have a feeling that if this is possible it would involve implicit differentiation or one of the other techniques I never quite mastered the first time around.

    Any help or even a pointer to a different (easier) approach would be much appreciated.

    Thanks,
    Dave.
    One way to do this is to take as the function to be minimized $\displaystyle (x- px)^2+ (y- py)^2+ (z- pz)^2$ (that's actually the square of the distance but minimizing it is the same as minimizing distance and this avoids the square root). You then have the additional condition, ax^2+ by^2+ cz^2+ d= 0.

    Use the geometric argument that Pulock2009 suggests with a little analysis: the gradient vector $\displaystyle \nabla (ax^2+ by^2+ cz^2+ d)= (2ax)\vec{i}+ (2by)\vec{j}+ (2cz)\vec{k}$ is always perpendicular to the surface and (x, y, z) will be closest to (px,py,pz) when the vector directly from one to the other, $\displaystyle (x- px)\vec{i}+ (y- py)\vec{j}+ (z- pz)\vec{k}$ (which, notice, is 1/2 the gradient of the "distance squared" function) is pointing perpendicular to the surface- that is the two vectors must be parallel which means one is a multiple of the other:

    $\displaystyle (2ax)\vec{i}+ (2by)\vec{j}+ (2cz)\vec{k}= \lambda((x- px)\vec{i}+ (y- py)\vec{j}+ (z- pz)\vec{k})$.

    where $\displaystyle \lambda$ is the multiple. (It is, technically, the "Lagrange multiplier".)

    That gives you four equations, $\displaystyle 2ax= \lambda(x- px)$, $\displaystyle 2by= \lambda(y- py)$, $\displaystyle 2cz= \lambda(z- pz)$, and the equation of the surface, $\displaystyle ax^2+by^2+cz^2+d=0$, to solve for x, y, z, and $\displaystyle \lambda$.

    Since you don't really need to know $\displaystyle \lambda$, I recommend dividing one equation by another to eliminate $\displaystyle \lambda$.
    For example, dividing $\displaystyle 2ax= \lambda(x- px)$ by $\displaystyle 2by= \lambda(y- py)$ gives $\displaystyle \frac{ax}{by}= \frac{x- px}{y- py}$ which we could solve for y as a function of x. Similarly, dividing [/tex]2ax= \lambda(x- px)[/tex] by $\displaystyle 2cz= \lambda(z- pz)$ gives $\displaystyle \frac{ax}{cz}= \frac{x- px}{z- pz}$ which you could solve for z as a function of x. Putting those into the equation of the surface gives one equation to solve for x.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Feb 2010
    From
    Midlands
    Posts
    3
    Thanks for the help

    I've rearranged the equations in the form $\displaystyle ax/by=(x-px)/(y-py)$ and get $\displaystyle y=axpy/((a-b)x+ypx)$ (and similar for $\displaystyle z$). However, when I come to substitute this into $\displaystyle ax^2+by^2+cz^2+d=0$ it gets a little complicated, and I'm not sure I can solve it using the general quadratic equation.

    Am I missing a glaringly simple solution? Otherwise I may have to abandon this path of thought as it is in a computationally sensitive piece of code and I'm not sure I can afford the increasing mathematical load.

    Thanks again for all the help.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: Apr 6th 2011, 06:44 AM
  2. Replies: 1
    Last Post: Apr 28th 2010, 07:59 PM
  3. Replies: 2
    Last Post: Nov 5th 2009, 12:05 PM
  4. Find the point on the line, closest to a point
    Posted in the Calculus Forum
    Replies: 3
    Last Post: Jul 14th 2009, 05:41 PM
  5. Replies: 2
    Last Post: Oct 5th 2008, 07:43 AM

Search Tags


/mathhelpforum @mathhelpforum