PlaneInt.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools
00003 //
00004 // GoTools module: Intersections, version 1.0
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef _PLANEINT_H
00034 #define _PLANEINT_H
00035 
00036 
00037 #include "AlgObj3DInt.h"
00038 #include "Point.h"
00039 #include <boost/shared_ptr.hpp>
00040 
00041 
00042 using namespace boost;
00043 
00044 
00045 namespace Go {
00048 
00049 
00050 
00051 class SplineSurface;
00052 
00053 
00055 
00056 class PlaneInt : public AlgObj3DInt
00057 {
00058 public:
00061     PlaneInt();
00062 
00066     PlaneInt(Point point, Point normal);
00067 
00074     PlaneInt(double a, double b, double c, double d);
00075 
00077     virtual ~PlaneInt();
00078 
00081     void read(std::istream& is);
00082 
00085     double a() const;
00088     double b() const;
00091     double c() const;
00094     double d() const;
00095 
00104     boost::shared_ptr<SplineSurface>
00105     surface(Point mid_pt, double length_x, double length_y) const;
00106 
00107 
00108 private:
00109 
00110     // (n_x, n_y, n_z)*(x - x_0, y - y_0, z - z_0) = 0.
00111     Point point_; // 3D ref point (x_0, y_0, z_0).
00112     Point normal_; // 3D normal direction (n_x, n_y, n_z).
00113 
00114     // Compute point_ & normal_.
00115     void computePoints();
00116 
00117     // Compute a, b, c & d based on point_ & normal_.
00118     void computeConstants(Point point, Point normal,
00119                           double& a, double& b, double& c, double& d) const;
00120 
00121     // We return the projection of the 3D input space_pt.
00122     Point projectPoint(const Point& space_pt) const;
00123 
00124 };
00125 
00126 
00128 } // namespace Go
00129 
00130 
00131 #endif // _PLANEINT_H
00132 
00133 

Generated on Fri Nov 23 12:24:33 2007 for GoTools Intersections Library by  doxygen 1.5.1