# Plane equation and distance

This topic is 2859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok so I about understand all there is to planes except for the 'd' in the equation of ax+by+cz +d = 0 and finding the distance from world origin.

While reading through here (GameDevJournal) at the third part is 'Get Plane Distance Using Plane Equation'. He says that d = -dotProduct(n,p) where n is a normal vector to the surface of the plane and p is already a point on the plane. This is a big 'well duh', you are figuring out 'd' here but won't the result always be 0? If you have a plan 100 units in whatever axis, the distance from the world-origin to this plane obviously isn't 0.

Aside from that, if 'd' is the distance from the world origin to the plane, what point on the plane is this the distance from? I only ask because a plane can be oriented in different ways. Some points may be closer to the world-origin than others and so on.

##### Share on other sites

While reading through here (GameDevJournal) at the third part is 'Get Plane Distance Using Plane Equation'. He says that d = -dotProduct(n,p) where n is a normal vector to the surface of the plane and p is already a point on the plane. This is a big 'well duh', you are figuring out 'd' here but won't the result always be 0? If you have a plan 100 units in whatever axis, the distance from the world-origin to this plane obviously isn't 0.

What makes you think the equation always gives you a value of d equal to zero?

Aside from that, if 'd' is the distance from the world origin to the plane, what point on the plane is this the distance from? I only ask because a plane can be oriented in different ways. Some points may be closer to the world-origin than others and so on.

The distance d is the smallest distance from the origin to any point on the plane. That is the point where a line from the origin in the direction of the plane's normal intersects the plane.

##### Share on other sites
You can look at this in 2D to see why:

dot(p,normal) = |p|.|normal|.cos(theta)

and since the normal is of unit length, you get:

dot(p,normal) = |p|.cos(theta)

which from highschool trigonometry lessons of right angled triangles is the red distance shown on the diagram being the distance from the plane to the origin

I like to think about the plane as being defined by it's normal and any point on the plane, with equation:

(x - p) dot n = 0, for any point x

then thinking about what the dot product says about two vectors when it is 0, the points 'x' that satisfy this are those such that if you take a vector from the point on the plane 'p' to the point 'x', it is perpendicular to the normal. If you use the diagram, and choose one of the points as being the 'p' and any other point on the line you'll see that to be true, and with some thought can visualise it in 3 dimensions also

##### Share on other sites

You can look at this in 2D to see why:

dot(p,normal) = |p|.|normal|.cos(theta)

and since the normal is of unit length, you get:

dot(p,normal) = |p|.cos(theta)

which from highschool trigonometry lessons of right angled triangles is the red distance shown on the diagram being the distance from the plane to the origin

I like to think about the plane as being defined by it's normal and any point on the plane, with equation:

(x - p) dot n = 0, for any point x

then thinking about what the dot product says about two vectors when it is 0, the points 'x' that satisfy this are those such that if you take a vector from the point on the plane 'p' to the point 'x', it is perpendicular to the normal. If you use the diagram, and choose one of the points as being the 'p' and any other point on the line you'll see that to be true, and with some thought can visualise it in 3 dimensions also

Your explanation and diagram helped me extremely. I was just visualizing the vector from the origin to a point on the plane wrong which lead me to my confusion.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 30
• 9
• 16
• 22