Definition at line 38 of file GLPlane.h.
Public Types | |
typedef GLVector3< T > | vector_type |
Typedef it so that the class is more resilient to change. | |
Public Member Functions | |
GLPlane () | |
Construct a zero plane, for convenience mainly. | |
GLPlane (const vector_type &n, const vector_type &op) | |
Construct a directed plane, with a translation so that op is on the plane. | |
GLPlane (const vector_type &op1, const vector_type &op2, const vector_type &op3) | |
Construct a directed plane, so that op[1,2,3] are on the plane. | |
GLPlane (const GLPlane &pl) | |
Normal copy constructor. | |
~GLPlane () | |
Normal destructor. | |
void | set (const vector_type &op1, const vector_type &op2, const vector_type &op3) |
3 point mutator, the three points for a plane | |
const vector_type & | getNormal (void) const |
Simple const accessor, normal. | |
void | setNormal (const vector_type &n) |
Simple mutator, normal. | |
const T & | getD (void) const |
Simple const accessor, deflection. | |
void | setD (const T &d) |
Simple mutator, deflection. | |
T | distanceToPoint (const vector_type &p) const |
Use this to find out how far away from the plane a point is. | |
T | intersectionWithLine (const vector_type &dir, const vector_type &origin) const |
Use this to find out how far along the line the plane is intersected. | |
vector_type | reflectedVector (const vector_type &in) const |
Use this to get a plane reflected vector. | |
GLMatrix< T > | reflectionMatrix () |
Get a plane reflection matrix from the plane equation. | |
GLMatrix< T > | directionalProjectionMatrix (const vector_type &dir) |
Get an orthogonal projection matrix. Useful for simple shadows and other casting. | |
GLMatrix< T > | pointProjectionMatrix (const vector_type &l) |
Point perspective projection of vertecies with respect to a projection source, useful for shadow projections. |
typedef GLVector3<T> mathglpp::GLPlane< T >::vector_type |
mathglpp::GLPlane< T >::GLPlane | ( | ) | [inline] |
mathglpp::GLPlane< T >::GLPlane | ( | const vector_type & | n, | |
const vector_type & | op | |||
) | [inline] |
mathglpp::GLPlane< T >::GLPlane | ( | const vector_type & | op1, | |
const vector_type & | op2, | |||
const vector_type & | op3 | |||
) | [inline] |
Construct a directed plane, so that op[1,2,3] are on the plane.
Definition at line 54 of file GLPlane.h.
References mathglpp::GLVector3< T >::dot(), and mathglpp::GLVector3< T >::normalize().
Here is the call graph for this function:
mathglpp::GLPlane< T >::GLPlane | ( | const GLPlane< T > & | pl | ) | [inline] |
mathglpp::GLPlane< T >::~GLPlane | ( | ) | [inline] |
void mathglpp::GLPlane< T >::set | ( | const vector_type & | op1, | |
const vector_type & | op2, | |||
const vector_type & | op3 | |||
) | [inline] |
3 point mutator, the three points for a plane
Definition at line 64 of file GLPlane.h.
References mathglpp::GLVector3< T >::dot(), mathglpp::GLVector3< T >::getCross(), and mathglpp::GLVector3< T >::normalize().
Here is the call graph for this function:
const vector_type& mathglpp::GLPlane< T >::getNormal | ( | void | ) | const [inline] |
void mathglpp::GLPlane< T >::setNormal | ( | const vector_type & | n | ) | [inline] |
const T& mathglpp::GLPlane< T >::getD | ( | void | ) | const [inline] |
void mathglpp::GLPlane< T >::setD | ( | const T & | d | ) | [inline] |
T mathglpp::GLPlane< T >::distanceToPoint | ( | const vector_type & | p | ) | const [inline] |
Use this to find out how far away from the plane a point is.
Definition at line 84 of file GLPlane.h.
References mathglpp::GLVector3< T >::dot().
Referenced by mathglpp::GLPlane< T >::reflectedVector().
00085 { return (normal.dot(p) + D); }
Here is the call graph for this function:
T mathglpp::GLPlane< T >::intersectionWithLine | ( | const vector_type & | dir, | |
const vector_type & | origin | |||
) | const [inline] |
Use this to find out how far along the line the plane is intersected.
Used for picking and simple raytracing mostly.
Definition at line 89 of file GLPlane.h.
References mathglpp::GLVector3< T >::dot().
Here is the call graph for this function:
vector_type mathglpp::GLPlane< T >::reflectedVector | ( | const vector_type & | in | ) | const [inline] |
Use this to get a plane reflected vector.
Definition at line 93 of file GLPlane.h.
References mathglpp::GLPlane< T >::distanceToPoint().
00094 { return in - (normal*(distanceToPoint(in))*2); }
Here is the call graph for this function:
GLMatrix<T> mathglpp::GLPlane< T >::reflectionMatrix | ( | ) | [inline] |
Get a plane reflection matrix from the plane equation.
Definition at line 97 of file GLPlane.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
00098 { 00099 GLMatrix<T> ret; 00100 00101 ret[0] = 1 - 2*(normal.x*normal.x); 00102 ret[4] = - 2*(normal.x*normal.y); 00103 ret[8] = - 2*(normal.x*normal.z); 00104 ret[12] = -2*normal.x*D; 00105 00106 ret[1] = - 2*(normal.y*normal.x); 00107 ret[5] = 1 - 2*(normal.y*normal.y); 00108 ret[9] = - 2*(normal.y*normal.z); 00109 ret[13] = -2*normal.y*D; 00110 00111 ret[2] = - 2*(normal.z*normal.x); 00112 ret[6] = - 2*(normal.z*normal.y); 00113 ret[10] = 1 - 2*(normal.z*normal.z); 00114 ret[14] = -2*normal.z*D; 00115 00116 ret[3] = 0; 00117 ret[7] = 0; 00118 ret[11] = 0; 00119 ret[15] = 1; 00120 00121 return ret; 00122 }
GLMatrix<T> mathglpp::GLPlane< T >::directionalProjectionMatrix | ( | const vector_type & | dir | ) | [inline] |
Get an orthogonal projection matrix. Useful for simple shadows and other casting.
Definition at line 125 of file GLPlane.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
00126 { 00127 GLMatrix<T> ret; 00128 00129 ret[0] = 1+1*(dir.x*normal.x); 00130 ret[4] = 1*(dir.x*normal.y); 00131 ret[8] = 1*(dir.x*normal.z); 00132 ret[12] = 1*dir.x*D; 00133 00134 ret[1] = 1*(dir.y*normal.x); 00135 ret[5] = 1+1*(dir.y*normal.y); 00136 ret[9] = 1*(dir.y*normal.z); 00137 ret[13] = 1*dir.y*D; 00138 00139 ret[2] = 1*(dir.z*normal.x); 00140 ret[6] = 1*(dir.z*normal.y); 00141 ret[10] =1+1*(dir.z*normal.z); 00142 ret[14] = 1*dir.z*D; 00143 00144 ret[3] = 0; 00145 ret[7] = 0; 00146 ret[11] = 0; 00147 ret[15] = 1; 00148 00149 return ret; 00150 }
GLMatrix<T> mathglpp::GLPlane< T >::pointProjectionMatrix | ( | const vector_type & | l | ) | [inline] |
Point perspective projection of vertecies with respect to a projection source, useful for shadow projections.
Definition at line 153 of file GLPlane.h.
References mathglpp::GLVector3< T >::dot(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
00154 { 00155 GLMatrix<T> ret; 00156 00157 T d = -l.dot(normal); 00158 T c = D - d; 00159 00160 ret[0] = -l.x*normal.x + c; 00161 ret[4] = -l.x*normal.y; 00162 ret[8] = -l.x*normal.z; 00163 ret[12]= -c*l.x - d*l.x; 00164 00165 ret[1] = -l.y*normal.x; 00166 ret[5] = -l.y*normal.y + c; 00167 ret[9] = -l.y*normal.z; 00168 ret[13]= -c*l.y - d*l.y; 00169 00170 ret[2] = -l.z*normal.x; 00171 ret[6] = -l.z*normal.y; 00172 ret[10] = -l.z*normal.z + c; 00173 ret[14]= -c*l.z - d*l.z; 00174 00175 ret[3] = -normal.x; 00176 ret[7] = -normal.y; 00177 ret[11] = -normal.z; 00178 ret[15]= -d; 00179 00180 return ret; 00181 }
Here is the call graph for this function: