# Re: Distance calculation

```
Michael,

You are looking for the "norm" (look that up in your books).

The 2D plane is embedded in the 3D grid, so each point
in this 2D plane is described by 3 coordinates call them
(X0,Y0,Z0).

The points in the 3D grid also each are described by 3 coordinates
call them (X1,Y1,Z1).

Then, the distance between a given point on the 2D plane and
a given point in the 3D grid is simply

N = sqrt( (x1-x0)**2 + (y1-y0)**2 + (z1-z0)**2 )

You will need to do this for each pair of points between which
you wish to compute the distance.

Hope this helps.

Jeff

Michael Spranger <q4668057@bonsai.fernuni-hagen.de> wrote:
>Geometry classes seem to be a long time ago...
>Since a couple of days, I am trying to bring at least some logic in a
>very simply looking problem:
>I want to calculate the distances of points on a 3D regular grid to a
>limited, 2D, planar area within the grid.
>Mathbooks provide a bunge of solutions for the distance between a
>point and a surface or for shortest distances between two lines (all
>refering to basic vector algebra..), but none seems to be applicable
>to this simple buffer problem I'd like to solve...
>
>As I want to code it in IDL, one of my hopes is, that somebody already
>solved this problem - or has heard of sombody who knows somebody
>who... - or simply that someone has a good idea for a
>not-too-good-mathematician.
>
>Thanks,
>Michael
>

```