Jump to content
  • Advertisement
Sign in to follow this  
ogl5

plane

This topic is 4002 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

I was just wondering what the best way to represent an infinite plane is in C++.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ogl5
I was just wondering what the best way to represent an infinite plane is in
C++.
The two most common representations used are probably a vector (the plane normal) and a scalar (the [pseudo]distance to the plane from the origin along that normal), and the hyperplane equation ax+by+cz+d = 0. In the hyperplane equation, a, b, and c correspond to the components of the plane normal, and 'd' is the negative of the distance in the normal-distance representation.

The question of how best to represent a plane is more or less language-independent, by the way (that is, none of the above is specific to C++ or any other language).

Share this post


Link to post
Share on other sites
The implicit formula for a plane:

Ax+By+Cz+D = 0

All mathematical definitions of planes are infinite.

So all you need to store is the normal of the plane: <A, B, C> and the constant D.
You can solve for D by choosing a point that lies in the plane <x,y,z> and subbing it into the equation.

No matter what the language you only need 4 floats to represent an infinite plane.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!