CUGL
2.0
|
#include <cugl.h>
Public Member Functions | |
Plane (GLfloat a=0, GLfloat b=1, GLfloat c=0, GLfloat d=0) | |
Plane (const Point &p, const Point &q, const Point &r) | |
Plane (const Line &s, const Point &p) | |
Plane (const Vector &v, const Point &p) | |
void | normalize () |
Plane | unit () const |
Vector | normal () const |
void | clipPlane (GLenum index) const |
GLfloat | getA () |
GLfloat | getB () |
GLfloat | getC () |
GLfloat | getD () |
Private Attributes | |
GLfloat | a |
GLfloat | b |
GLfloat | c |
GLfloat | d |
Friends | |
class | Matrix |
Point | meet (const Line &k, const Plane &p) |
bool | operator== (const Plane &x, const Plane &y) |
bool | operator!= (const Plane &x, const Plane &y) |
std::ostream & | operator<< (std::ostream &os, const Plane &p) |
GLfloat | dist (const Point &p, const Plane &s) |
GLfloat | dist (const Plane &s, const Point &p) |
An instance is a plane defined by its equation Ax+By+Cz+D=0.
Planes are used for clipping, shadows, and reflections (see class Matrix).
Homogeneous points (x,y,z,w) lie on the plane if Ax+By+Cz+Dw=0. The notation for a plane is <A,B,C,D>. The plane <0,0,0,D> is undefined. An attempt to construct such a plane sets the error flag to BAD_PLANE and the plane is set to <0,1,0,0> (in the conventional OpenGL frame, this often corresponds to the ground, y=0).
A Plane is in normal form if the Vector (A,B,C) is a unit vector. A Plane can be normalized by scaling A,B,C,D.
cugl::Plane::Plane | ( | GLfloat | a = 0 , |
GLfloat | b = 1 , |
||
GLfloat | c = 0 , |
||
GLfloat | d = 0 |
||
) |
Construct a plane given the coefficients of its equation Ax+By+Cx+D=0. If no arguments are provided, construct the plane y = 0.
Construct a plane containing the three given points.
Construct a plane containing the line s
and the point p
.
Construct the plane orthogonal to v
and passing through p
.
void cugl::Plane::clipPlane | ( | GLenum | index | ) | const |
Use this plane as a clipping plane. This function calls glClipPlane
to suppress rendering of objects on one side of the plane.
index | must be one of GL_CLIP_PLANE0, GL_CLIP_PLANE1, ... A An implementation of OpenGL is supposed to provide at least six clipping planes, numbered 0,1,...,5. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void cugl::Plane::normalize | ( | ) |
Plane cugl::Plane::unit | ( | ) | const |
Return the distance between a Point and a Plane. The result has the correct magnitude only if the Point and the Plane are both in normal form. In particular, the result is incorrect if the Point is at infinity. However, the sign of the result is correct in all cases, and so it is not necessary to provide normalized arguments if only the sign is important.
Return the distance between a Point and a Plane. The result has the correct magnitude only if the Point and the Plane are both in normal form. In particular, the result is incorrect if the Point is at infinity. However, the sign of the result is correct in all cases, and so it is not necessary to provide normalized arguments if only the sign is important.
Find the point where this line meets the plane p.
|
friend |
Write a description of the plane to the output stream as <a,b,c,d>. Inserts the components of the plane into the output stream os
in the format <a,b,c,d>. The current settings of the stream formatting parameters are used. If a width is specified with setw()
, it is applied to each component rather than to the plane as a whole.
|
private |
Coefficient of x in the plane equation.
Definition at line 580 of file cugl.h.
Referenced by cugl::dist(), getA(), normal(), and cugl::operator==().
|
private |
Coefficient of y in the plane equation.
Definition at line 583 of file cugl.h.
Referenced by cugl::dist(), getB(), normal(), and cugl::operator==().
|
private |
Coefficient of z in the plane equation.
Definition at line 586 of file cugl.h.
Referenced by cugl::dist(), getC(), normal(), and cugl::operator==().
|
private |
Coefficient of w in the plane equation.
Definition at line 589 of file cugl.h.
Referenced by cugl::dist(), getD(), and cugl::operator==().