00001 //=========================================================================== 00002 // GoTools - SINTEF Geometry Tools version 1.1 00003 // 00004 // GoTools module: CORE 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 _GOHERMITEGRID1D_ 00034 #define _GOHERMITEGRID1D_ 00035 00036 #include <vector> 00037 #include "Point.h" 00038 00039 namespace Go 00040 { 00043 00044 00045 class EvalCurve; 00046 00051 00052 class HermiteGrid1D 00053 { 00054 public: 00055 00062 HermiteGrid1D(const EvalCurve& crv, double start, double end); 00063 00070 HermiteGrid1D(const EvalCurve& crv, double param[], int n); 00071 00073 ~HermiteGrid1D(); 00074 00080 int addKnot(const EvalCurve& crv, double knot); 00081 00090 void getSegment(int left, int right, double& spar, 00091 double& epar, Point bezcoef[4]); 00092 00094 std::vector<double> getKnots() { return knots_; } 00095 00097 std::vector<Point> getData() { return array_; } 00098 00100 int dim(){ return dim_; } 00101 00103 int size() {return MM_;} 00104 00105 private: 00106 std::vector<double> knots_; // Sorted array of DISTINCT parameters of curve 00107 std::vector<Point> array_; // Array holding position, and 00108 // directional derivative 00109 int dim_; // Spatial dimension of position, 00110 int MM_; // Number of grid points 00111 int elem_size_; // Number of Point stored for each 00112 // grid point (typically 2: pt, der) 00113 int index_; // Index into knot array 00114 00115 00116 int getPosition(double knot); 00117 00118 }; 00119 00121 } // namespace Go 00122 00123 #endif 00124