00001 #ifndef MATH_PLANE_H 00002 #define MATH_PLANE_H 00003 00004 /* 00005 00006 GLT OpenGL C++ Toolkit (LGPL) 00007 Copyright (C) 2000-2002 Nigel Stewart 00008 00009 Email: nigels.com@gmail.com 00010 WWW: http://www.nigels.com/glt/ 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 00026 */ 00027 00033 #include <math/vector3.h> 00034 00041 class BoundingBox; 00042 class Matrix; 00043 00044 class Plane 00045 { 00046 public: 00048 Plane(); 00050 Plane(const Vector &pos,const Vector &dir); 00051 00053 Vector &direction(); 00055 const Vector &direction() const; 00056 00058 double d() const; 00060 double &d(); 00061 00063 bool operator==(const Plane &plane) const; 00064 00066 void transform(const Matrix &trans); 00068 void flip(); 00069 00071 real dist(const Vector &pos) const; 00073 bool inside(const Vector &pos) const; 00074 00076 real dist(const BoundingBox &box) const; 00077 00079 real intersect (const Vector &p0,const Vector &p1) const; 00081 Vector intersectPosition(const Vector &p0,const Vector &p1) const; 00082 00083 protected: 00084 00086 Vector _pos; 00088 Vector _direction; 00090 double _d; 00091 }; 00092 00093 #endif