00001 /* 00002 * lib/numerics/3d/plane3.h 00003 * 00004 * Plane template which represents plane in 3 dimensions. 00005 * 00006 * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 00007 * 00008 * This file may be distributed and/or modified under the terms of the 00009 * GNU General Public License version 2 as published by the Free Software 00010 * Foundation. (See COPYING.GPL for details.) 00011 * 00012 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 * 00015 */ 00016 00017 #ifndef _LIB_NUMERICS_3D_PLANE3_H_ 00018 #define _LIB_NUMERICS_3D_PLANE3_H_ 1 00019 00027 #include <lib/numerics/num_math.h> 00028 #include <lib/numerics/3d/vector3.h> 00029 00030 00031 namespace NUM // numerics 00032 { 00033 00054 template<typename T=dbl>class Plane3 00055 { 00056 private: 00057 Vector3<T> _normal; 00058 T _dist; 00059 00060 public: 00062 inline Plane3() {} 00065 inline Plane3(const Vector3<T> &n,T d) : _normal(n), _dist(d) {} 00067 inline ~Plane3() {} 00068 00070 inline Vector3<T> &normal() { return(_normal); } 00071 inline const Vector3<T> &normal() const { return(_normal); } 00072 00074 inline T &dist() { return(_dist); } 00075 inline const T &dist() const { return(_dist); } 00076 00078 inline T normalize() 00079 { return(_normal.normalize()); } 00080 00083 inline T distance(const Vector3<T> &point) 00084 { return(dot(_normal,point)+_dist); } 00085 00090 int compute(const Vector3<T> &p0,const Vector3<T> &p1, 00091 const Vector3<T> &p2); 00092 00111 int PointFit(int args_not_specified); 00112 00113 }; 00114 00115 } // end of namespace NUM 00116 00117 #endif /* _LIB_NUMERICS_3D_PLANE3_H_ */