Is this Plane Equation tutorial wrong?
************************
'd' - the distance, and the Dot Product
The next part of the plane equation is 'd'. This is the distance from the origin to the point on the plane which is nearest to the origin. This is calculated using a function called the Dot Product. (aka the Scalar Product) The dot product take two vectors as an input, and results in a scalar. The dot product has more than one use. It will calculate the 'distance' from the plane to the origin (what we are calculating now) if given the planes normal, and a point on the plane. (This is used in raytracing) If the two vectors given to it are normalized, it will result on the cosine of the angle between the two vectors. Anyway, the previous use (calculating a planes 'distance' from the origin) is what we will be doing now. We have calculated the normal (it must be normalized), and we need a point on the plane. For the point on the plane, we use one of the vertices of the triangle. Vertex A is used in the formula below, in which 'd' is calculated, using the dot product.
d = (N.x * A.x) + (N.y * A.y) + (N.z * A.z)
****************
Um, is that wrong? I thought the Plane Equation was Ax + By + Cz + D = 0? I would have thought that you substitute normal (A.B.C) and a point (x,y,z) into the equation and solve for D by negating Ax + By + Cz...
If this tutorial is wrong, its caused me headaches all day!
Thanks
Well, there's two ways of writing plane equation:
A*x+B*y+C*z+D=0
and
A'*x+B'*y+C'*z-D'=0
Do some algebra and you'll get:
A*x+B*y+C*z=-D for first equation and
A'*x+B'*y+C'*z=D' for second equation.
Matter of convention, really. You can choose to write negative distance and you get A*x+B*y+C*z+D=0, or store positive distance and you get A*x+B*y+C*z=D
Of course D'=-D and vice-versa.
A*x+B*y+C*z+D=0
and
A'*x+B'*y+C'*z-D'=0
Do some algebra and you'll get:
A*x+B*y+C*z=-D for first equation and
A'*x+B'*y+C'*z=D' for second equation.
Matter of convention, really. You can choose to write negative distance and you get A*x+B*y+C*z+D=0, or store positive distance and you get A*x+B*y+C*z=D
Of course D'=-D and vice-versa.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement