View Full Version : glClipPlane - Plane equation?

04-14-2001, 06:02 AM
I've got some problems with using glClipPlanes(GL_CLIP_PLANEi, GLdouble* equation):
All the docs I found say equation is a GLdouble quadruple specifiying the clipping plane's equation...
I only know two equations for planes:
1. Specify a vektor which points to a vertex on the planes and specify two non-parallel vectors that lie within the plane.
2. Specify a vector which points to a vertex on the plane an which is a the same time a normal of that plane.

glClipPlane cannot use the first way and the second one doesn't semm to work either:
I interpreted the 4 coordinates as the normal vector starting at the origin *and starting at the eye position... Both ways didn't produce the expected results.

Help me please, until know I spent WAY to much time on this topic.

Michael Steinberg
04-14-2001, 06:19 AM

x = a + r*b + s*c

so you've got

x1 = a1 + r*b1 + s*c1
x2 = a2 + r*b2 + s*c2
x3 = a3 + r*b3 + s*c3

Put that all into a single equation and you'll have

A*x1 + B*x2 + C*x3 = D

Michael Steinberg
04-14-2001, 06:21 AM
Where the vector ABC is the normal besides...

04-14-2001, 06:30 AM
So A,B,C and D would be 3-dim vectors, right?
But that would mean I had to specify 12 coordinates.

Michael Steinberg
04-14-2001, 06:37 AM

x1 = a1 + r*b1 + s*c1
x2 = a2 + r*b2 + s*c2
x3 = a3 + r*b3 + s*c3

(x1-a1-s*c1)/b1 = r

x2 = a2 + (x1-a1-s*c1)/b1*b2 + s*c2

and so on.

With vector ABC I meant (A,B,C)

04-16-2001, 12:23 AM
In my red book, 3rd Ed. (OpenGL 1.2) p140 under glClipPlane() it says that " ... equation argument points to the four coefficients of the plane equation, Ax + By + Cz + D = 0 ... " just like Michael Steinberg says. I like to think of it (like Michael) as a normal vector (A, B, C) and a point on the plane gives you D.

For example, if the normal vector is (3, 4, 5) and a point on the plane is (1, 1, 1), then substituting in gives 3*1 + 4*1 + 5*1 + D = 0 => D = -12.

Michael Steinberg
04-16-2001, 04:34 AM
I just wanted to state the correlation between his and the opengl representation of a plane... http://www.opengl.org/discussion_boards/ubb/smile.gif