GPlane.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by the G System Team                               *
00003  *   http://www.g-system.at                                                *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GPLANEH
00026 #define GPLANEH
00027 
00028 #include "GMatrix44.h"
00029 #include "GVector3.h"
00030 
00031 
00032 #include <cmath>
00033 
00034 class QString;
00035 
00036 namespace GCS
00037 {
00038 
00046 class GPlane
00047 {
00048   public:
00049   
00050     union
00051     {
00052         struct
00053         {
00054             double a; // Variables for the plane equation
00055             double b;
00056             double c;
00057             double d;
00058         };
00059 
00060 //         struct
00061 //         {
00062 //             GVector3 n; // Normalvector
00063 //             double d; // Distance
00064 //         };
00065 
00066         double v[4];
00067     };
00068 
00069     GPlane();
00070    
00071     GPlane(const double a, const double b, const double c, const double d);
00072     
00073     GPlane(const double* value);
00074     
00075     GPlane(const GCS::GVector3& n, double d);
00076     
00077     
00081     GPlane(const GCS::GVector3& p, const GCS::GVector3& n);
00082     
00086     GPlane(const GCS::GVector3& v1, const GCS::GVector3& v2, const GCS::GVector3& v3);
00087     
00088     
00092     GPlane& normalize();
00093     
00094     
00098     GPlane& transform(const GMatrix44& m);
00099     
00100     
00104     double PlanePointDistance(const GCS::GVector3& point) const;
00105     
00106     
00110     operator double* ();
00111 
00115     GPlane operator = (const GPlane& p);
00116     
00120     bool operator == (const GPlane& p) const;
00121     
00125     bool operator != (const GPlane& p) const;
00126 
00127 
00128 };
00129 
00130 };
00131 
00132 #endif

Generated on Thu Nov 16 07:49:12 2006 for G System by  doxygen 1.4.7