//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //===========================================================================

ApproxCurve.h

Go to the documentation of this file.
00001 #ifndef _APPROXCURVE_H_
00002 #define _APPROXCURVE_H_
00003 
00004 //   -----------------------------------------------------------------------
00005 //      Interface file for class ApproxCurve
00006 //   -----------------------------------------------------------------------
00007 //
00008 //       Approximate a set of points by a B-spline curve to
00009 //       satisfy a given accuracy
00010 //
00011 //       Implementation of the member functions are given in the
00012 //       following files:
00013 //
00014 //          1. ApproxCurve.C
00015 //
00016 //   -----------------------------------------------------------------------
00017 //    Written by: Vibeke Skytt                           04-02
00018 //   -----------------------------------------------------------------------
00019 
00020 #include "GoTools/geometry/SplineCurve.h"
00021 #include <vector>
00022 #include "GoTools/creators/SmoothCurve.h"
00023 
00024 namespace Go
00025 {
00028 class ApproxCurve
00029 {
00030 public:
00042     ApproxCurve(const std::vector<double>& points, 
00043                   const std::vector<double>& parvals,
00044                   int dim, double aepsge);
00045 
00058     ApproxCurve(const std::vector<double>& points, 
00059                   const std::vector<double>& parvals,
00060                   int dim, double aepsge, int in, int ik);
00061 
00073     ApproxCurve(const std::vector<double>& points, 
00074                   const std::vector<double>& parvals, int dim,
00075                   double aepsge, int in, int ik,
00076                   std::vector<double>& knots);
00077 
00079     ~ApproxCurve();
00080 
00083     void setSmooth(double w);
00084 
00085 
00087     void unsetSmooth();
00088 
00091 
00100     void setEndPoints(const std::vector<Point>& start_point, 
00101                       const std::vector<Point>& end_point);
00102 
00112     boost::shared_ptr<SplineCurve> getApproxCurve(double& maxdist, 
00113                                                   double& avdist,
00114                                                   int max_iter = 5);
00115 protected:
00117     ApproxCurve();
00118 
00119 private:
00120   boost::shared_ptr<SplineCurve> curr_crv_;
00121   double maxdist_;
00122   double avdist_;
00123   double aepsge_;
00124   double smoothweight_;
00125   double smoothfac_;
00126 
00127   int dim_;
00128   std::vector<double> points_;
00129   std::vector<double> parvals_;
00130   std::vector<Point> start_pt_; // Pt, der. May be empty.
00131   std::vector<Point> end_pt_; // Pt, der. May be empty.
00132 
00134   void makeInitCurve();
00135 
00136   void makeInitCurve(int in, int ik, std::vector<double> knots);
00137 
00138   void makeInitCurve(int in, int ik);
00139 
00142   void adjustSmoothWeight();
00143 
00145   void makeSmoothCurve();
00146 
00148   void checkAccuracy(std::vector<double>& newknots, int uniform=1);
00149 
00151   int doApprox(int max_iter);
00152 
00153   void getConstraints(std::vector<sideConstraint>& pt_constraints,
00154                       std::vector<sideConstraint>& tangent_constraints);
00155 
00156 };
00157 }
00158 
00159 #endif
00160 
Generated on Tue Sep 21 15:44:16 2010 for GoTools Core by  doxygen 1.6.3