Plane equation, + or - D

Started by
14 comments, last by fais 7 years, 6 months ago

If you like dot products, Ax+By+Cz+D=0 corresponds to (A,B,C,D) dot (x,y,z,1)=0, consistent with the popular use of homogeneous coordinates with 4 by 4 transformation matrices and 3D points (x,y,z) conventionally represented as (x,y,z,1).

Omae Wa Mou Shindeiru

Advertisement

Another (visual) take on it.

Imagine the ZX plane (X is +ve to right, Z is +ve into screen and Y is +ve up).

So the Y axis is the ZX plane's normal.

Now consider a point on the plane, say X=5, Y=0, Z=5.

So what's the distance D?

Plane's normal (N) is 0, 1, 0.

Point (P) is 5, 0, 5.

So N dot P is N.x * P.x + N.y * P.y + N.z * P.z = 0 * 5 + 1 * 0 + 0 * 5 = 0.

Now grab the ZX plane with your imaginary hands and pull it up the Y-axis (the ZX plane's normal) by 1 unit.

Now consider point P on this new plane. Let P = X = 5, Y = 1 (because we moved the plane up by one unit) and Z = 5.

So basically our original point P but translated up 1 unit in Y direction so it sits on our translated ZX plane (also translated 1 unit in Y direction).

Now let's calculate dot product of our new plane normal (which is same as last one as is a vector and so unaffected by translation), N = 0, 1, 0

And our new point P = X = 5, Y = 1 and Z = 5.

Now the dot product or our distance D = N.x * p.x + N.y * P.y + N.z * P.z = 0 * 5 + 1 * 1 + 0 * 5 = 1.

Finally let's try another point on same plane, say P = 10, 1, 10.

Again the dot product or our distance D = N.x * p.x + N.y * P.y + N.z * P.z = 0 * 10 + 1 * 1 + 0 * 10 = 1.

Same distance.

So you can think of D as being the distance (along the direction of the Plane's normal) of the plane from the global origin.

(I think)

Hi guys, quick question on the plane equation and finding if a point is on a plane or not.

Given a plane defined by a normal (ABC) and a distance from origin (D). I've read articles describing that a point is on the plane if it satisfies the plane equation:

Ax + By + Cz + D = 0

mathematical, Dirk already gave a good answer to your question, but I wanted to stress that it is a good idea to try to work "coordinate free." I.e. where possible, avoid formulas that expose the x, y, z coordinates, like the above "plane equation" does. Instead, like Dirk said (and as I also discuss in my book), it's better to consider planes as being defined by the set of vectors that are perpendicular to the plane normal, and that have an "origin" defined by any point on the plane.

In other words, let N be the plane normal, let P be any point on the plane, and let X be all other points on the plane. Then we can express this relationship as:

Dot(N, X - P) = 0.

I.e. the vectors N and X - P need to be perpendicular.

You can expand that expression in two ways:

Dot(N, X - P) = Dot(N, X) - Dot(N, P) = ... = n.x * x.x + n.y * x.y + n.z * x.z - d

or

Dot(N, X - P) = Dot(N, X) + Dot(N, -P) = ... = n.x * x.x + n.y * x.y + n.z * x.z + d

Which is why you see the expanded explicit-coordinate plane equation sometimes with '-' and sometimes with '+'. Both are correct, and the difference is just that the 'd' constant is negated between the two expressions.

Hope that helps.

Both + and - D are a fancy way of saying the same thing "the plane comprises of all 3D points whose projection along a particular axis (the plane normal) equals to distance D".

How you store/evaluate it is inconsequential as long as you are consistent.

I in particular do not call the variable D in my engine, rather something more meaningful like "distance", for the exact same reason: it was causing confusion as to how I was representing it and having me constantly revisit the code.

I in particular do not call the variable D in my engine, rather something more meaningful like "distance", for the exact same reason: it was causing confusion as to how I was representing it and having me constantly revisit the code.


Except it might confuse people reading your code when something named "distance" is negative.

I in particular do not call the variable D in my engine, rather something more meaningful like "distance", for the exact same reason: it was causing confusion as to how I was representing it and having me constantly revisit the code.

Except it might confuse people reading your code when something named "distance" is negative.

You are correct, distance doesn't imply direction. Thinking about it some more I beleive I actually changed it from "D" to "distance", and then to "projection" (or "proj" because I code lazy) for the exact reason, so I misspoke.

Fortunately, no one is having read my code otherwise I'd be doing no many things better.

This topic is closed to new replies.

Advertisement