Jump to content
  • Advertisement
Sign in to follow this  
Mr Lane

Is this Plane Equation tutorial wrong?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

************************ '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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!