Sign in to follow this  
ogl5

plane

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this