# Finding the distance between a plane and a point using the normal

1. Feb 7, 2012

### Endevor

Ok, I've been stewing on this problem for a couple weeks now, and it's primarily due to my lack of practice with vectors, but I'm learning how to work with 3D computer graphics and trying to determine when an object hits a plane. Given the normal of the plane N=[nx,ny,nz] and the point at the center of my sphere, P=(px,py,pz), how do I find the distance from the Point at the center of the sphere to the plane?

From what I understand, there's some way to do it using the origin 'O' to find the point K along a vector T. We also know a vector S from O to point P. Where I'm stuck right now is finding K. If I can find Rp, then I can use T+Vector(Goal)=S.

I may be going about this a completely wrong way, in which case, ignore my short thoughts and use what I wrote above. I just need some help on how to approach this.

File size:
5.1 KB
Views:
133
2. Feb 7, 2012

### Bacle2

This is a kind of standard problem. Think of using orthogonal projections; once you're
in the normal vector, you know how to find the distance. I'm being kind of cryptic since I don't know if you want a full answer or you want to deduce it for yourself.

3. Feb 8, 2012

### Endevor

I'd like to be able to deduce it myself, but since I've been stewing on this for too long, a full answer would also be nice. I'm new with vectors, never really used them before. When working in 2D graphics I only used equations for the lines, but the course I'm taking in 3D wants us to use vectors and it seems no one understands what's going on. If you give me a full answer, I would like to see how you came to it so I just don't take the product and run. Otherwise, the issue I'm stuck with is finding another point on the plane (Point K if I remember my doodle right) when only given the normal to that plane.

Also new here, I guess this should be posted in the coursework forum, I apologize for my mistake.

Last edited: Feb 8, 2012
4. Feb 8, 2012

### Bacle2

Don't mean to cop out on you, Endevor; I think these links may be better than my explaining, since they include images.

Basically, the shortest distance between a point p and a line L is the orthogonal
projection , when given a system of axes; this is what you do when you represent
a point (a,b,c) in R^3; a,b,c are, respectively, the orthogonal projections onto the
x,y,z axes. Now, given a vector, you can use the normal in the plane as an axis
to project into. See these links, and I'll get back to you when I can. Good luck!

Or, maybe more to the point, in :

http://www.math4all.in/public_html/linear algebra/chapter8.1.html

'A' is your point, OB is the (a) normal vector to the plane (i.e., all vectors thru O that are perpendicular
to OB). Then the orthogonal projection Orth(OA)_OP of OA into the normal vector OP will give you the shortest distance,
i.e., || Orth(OA)|| is the smallest distance from OA to the plane ( the plane!, the plane!)

Last edited: Feb 8, 2012
5. Feb 10, 2012

### Endevor

Thanks for the help! Sorry it took me a while to get back. I ended up figuring the problem out, turned out he had presented the question in a confusing manner in which we though he told us that we didn't know another point on the plane, just the normal. What he really wanted was for us to assume a point on the plane, just didn't explain that clearly. Thanks for the help!

6. Feb 10, 2012

### Matterwave

A real easy way to think about this is first set up a coordinate system in which your normal vector is simply (0,0,n) (i.e. your plane is your x-y plane). In this case, I think it's quite obvious that given the point of the center of the sphere (px, py, pz), that the distance is very simply pz. This is (P dot n) where P is the vector to the center of the sphere.

Since rotations preserve inner products, then it's obvious that the general distance, given a general plane and sphere (assuming that the plane at least intersects your origin, so I'm not including translations of the coordinate system here), is still (P dot n), or px*nx+py*ny+pz*nz.

Here I've defined P as the vector to the center of the sphere, and n as the normal (unit) vector to the plane.