Signed Distance Function - Sphere

Your browser does not support the HTML5 canvas tag.
0

Signed distance function of a sphere:

The signed distance function of a sphere with radius $r$ is defined as: $$\Phi(\mathbf{x}) = \| \mathbf{x} - \mathbf{x}_{\text{sphere}} \| - r.$$ In the example $\mathbf x$ is the red point, $\mathbf{x}_{\text{sphere}}$ the blue point and the closest point to $\mathbf x$ on the surface of the sphere is rendered in yellow.

Surface normal vector

The normal vector is defined by the gradient of the signed distance function: $$\mathbf n = \frac{\partial \Phi(\mathbf{x})}{\partial \mathbf x} = \frac{\mathbf{x} - \mathbf{x}_{\text{sphere}}}{\| \mathbf{x} - \mathbf{x}_{\text{sphere}}\|}. $$

Closest point on the surface

The closest point $\mathbf s$ on the surface of the sphere (yellow) can be determined by starting at the point $\mathbf x$ (red) and going by the signed distance in the direction of the negative normal vector: $$\mathbf s = \mathbf x - \Phi(\mathbf{x}) \mathbf n.$$