Plane equation and distance

Started by
2 comments, last by Sansros 12 years, 4 months ago
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.
Advertisement

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.
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
FKnZM.png
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

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
FKnZM.png
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.

This topic is closed to new replies.

Advertisement