Re: Distance from plane to point

Mads Dydensborg (madsdyd@diku.dk)
Thu, 28 Mar 1996 09:00:01 +0100 (MET)

Date: Thu, 28 Mar 1996 09:00:01 +0100 (MET)
From: Mads Dydensborg <madsdyd@diku.dk>
To: quake-editing@nvg.unit.no
Subject: Re: Distance from plane to point
In-Reply-To: <Pine.HPP.3.91.960326112326.27185A-100000@embla.diku.dk>

On Tue, 26 Mar 1996, Uffe Friis Lichtenberg wrote:

> On Tue, 26 Mar 1996, Tom Wheeley wrote:
>
> > In article <01BB1A6C.CBC201A0@ppp001.free.org> you write:
> >
> > > BTW, I'm having a little trouble understanding how to figure the =
> > > distance between (0,0,0) and a plane. If anyone could enlighten me on =
> > > this subject I be really grateful.
> >
> > Eh? How is your plane definition stored? id store their planes:
> >
> > r.n-hat = d (n-hat is an `n' with a `^' circonflex (sp?) on top.)
> >
> > Where `d' _is_ the distance from (0,0,0) and `r' is a general point, and `.'
> > is the scalar product (x1*x2+y1*y2+z1*z2). n-hat is the unit-vector stored
> > at the beginning of each plane entry in the BSP, it is followed by `d'.
> >
> > It is hard to help without knowing just what information you do have about
> > your plane.
>
> I couldn't quite follow that, so maybe I can be of help...
>
> You've got an equation for the plane
>
> a*x+b*y+c*z+d=0
>
> The distance from any point (x',y',z') to the plane should be given by
>
> sqrt(a*x'+b*y'+c*z'+d)
No. The distance is given as
a*x' + b*y' + c*z' + d
dist =------------------------
(+/-) sqrt(a*a+b*b+c*c)

where the sign is chosen, so that dist is positive.
This formula is from Schaum's outline series, 'Solid analytic geometry'.
(12.13)
Mads

+---------------------------------------------------------------------+
| Mads Bondo Dydensborg. Student at DIKU, Copenhagen - Denmark. |
| Email: madsdyd@diku.dk www: http://www.diku.dk/students/madsdyd |
+---------------------------------------------------------------------+