Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

glplane.h

00001 /***************************************************************************
00002                           glplane.h  -  description
00003                              -------------------
00004     begin                : Wed Aug 20 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef GLPLANE_H
00019 #define GLPLANE_H
00020 
00021 #include "glvector.h"
00026 class GLPlane
00027 {
00028    GLVector normal;
00029    GLfloat D;
00030 public: 
00031 
00032    GLPlane() { normal.set(0,0,0); D = 0; };
00033    GLPlane(GLVector n, GLVector op);
00034    GLPlane(GLVector op1, GLVector op2, GLVector op3);
00035 
00036    inline void set( GLVector n, GLVector op)
00037    { normal = n; D = -(normal.dot(op)); }
00038 
00039    inline void set( const GLVector& op1, const GLVector& op2, const GLVector& op3 )
00040    { normal = (op3 - op2).getCross( (op1 - op2) );  normal.normalize(); D = -(normal.dot(op1)); }
00041 
00042    const GLVector& getNormal(void) const
00043    { return normal; }
00044    
00045    inline void setNormal(const GLVector& n)
00046    { normal = n; }
00047 
00048    GLfloat distanceToPoint(const GLVector& p) const;
00049    GLfloat intersectionWithLine(GLVector dir, GLVector origin) const;
00050    GLVector reflectedVector(GLVector& in) const;
00051    
00052     ~GLPlane();
00053 };
00054 
00055 #endif

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3