//=========================================================================== // 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. //===========================================================================

SmoothCurve.h

Go to the documentation of this file.
00001 #ifndef _SMOOTHCURVE_H_
00002 #define _SMOOTHCURVE_H_
00003 
00004 
00005 //   -----------------------------------------------------------------------
00006 //      Interface file for class SmoothCurve
00007 //   -----------------------------------------------------------------------
00008 //
00009 //       Used to modify a tensor product B-spline surface with respect
00010 //       to conditions on smoothness, editing constraints and boundary
00011 //       conditions.
00012 //
00013 //       Implementation of the member functions are given in the
00014 //       following files:
00015 //
00016 //          1. SmoothCurve.C
00017 //             a. SmoothCurve()
00018 //             b. ~SmoothCurve()
00019 //             c. attach()
00020 //             d. setOptim()
00021 //             e. setLeastSquares()
00022 //             f. equationSolve()
00023 //
00024 //   -----------------------------------------------------------------------
00025 //    Written by: Vibeke Skytt                            28-04.1998.
00026 //   -----------------------------------------------------------------------
00027 
00028 #include "GoTools/geometry/SplineCurve.h"
00029 #include "GoTools/creators/ConstraintDefinitions.h"
00030 //#include "newmat.h"
00031 #include <boost/smart_ptr.hpp>
00032 
00033 #include <vector>
00034 
00035 
00036 namespace Go
00037 {
00038 
00048 class SmoothCurve 
00049 {
00050 
00051  public:
00052 
00056     SmoothCurve(int dim = 3);
00057 
00059     ~SmoothCurve();
00060 
00062 
00071     int attach(const boost::shared_ptr<SplineCurve>& incurve,
00072                int coef_known[],
00073                int numSideConstraints = 0);
00074 
00080     void setOptim(const double weight1, const double weight2,
00081                   const double weight3);
00082 
00091     void setLeastSquares(std::vector<double>& pnts,
00092                          std::vector<double>& param_pnts,
00093                          std::vector<double>&  pnt_weights,
00094                          double weight);
00095 
00100     void setPeriodicity(int cont, double weight);
00101 
00106     void setSideConstraints(std::vector<sideConstraint>& constraints);
00107 
00110     void equationSolve(boost::shared_ptr<SplineCurve>& curve);
00111 
00112 
00113  private:
00114     int idim_;             // Dimension of geometry space.
00115     int kdim_;             // Dimension of homogeneous space.
00116     int ider_;             // Maximum derivative involved in the computations. 
00117 //     int cont_bound[2];    // Fixed continuity at each endpoint, i.e. the number
00118 //     // of coefficients not to be changed.
00119     int cont_seam_;        // Number of rows affected by continuity at the seam
00120     int kcond_; // Number of unknowns in equation system (# of coefs + kconstraint).
00121     int kconstraint_; // # of constraints.
00122 
00123     int *coefknown_;       // Array indicating the status of coefficients, i.e.
00124     // free, fixed, not involved, equal to a given
00125     // coefficients.
00126     std::vector<int> pivot_;    // Array giving the position of the free coefficients
00127     // in the equation system.   
00128 
00129     // The input curve
00130     boost::shared_ptr<SplineCurve> qcurve_;
00131 
00132     // Parameters defining the spline space.
00133     int kk_;         // Order of curve.
00134     int kn_;         // Number of coefficients of curve.                
00135     std::vector<double>::const_iterator st_;     // Pointer to knot  of curve.
00136 
00137     // Rational case
00138     bool rational_;    // Is curve rational?
00139     boost::shared_ptr<SplineCurve> bspline_curve_;  // 1-dimensional rational curve with
00140                                                     // 0's as control values, and weights from 
00141                                                     // input curve. Used to calculate B-splines
00142                                                     // for the rational case
00143 
00144     // Parameters used to define the specific input spline curve.
00145     std::vector<double>::iterator scoef_; // Pointer to coefficients.          
00146 
00147     // Parameters used in integration
00148     double ***integral_;   // Array used to store integrals of inner product
00149 
00150     // Storage of the equation system.
00151     //Matrix gmat_;       // Matrix at left side of equation system.
00152     //ColumnVector gright_;    // Right side of equation system. 
00153     std::vector<std::vector<double> > gmat_; // Matrix at left side of equation system
00154     std::vector<double> gright_; // Right side of equation system
00155 
00157     // \return return value 0 = OK, negative return value = failure.
00158     int prepareIntegral();
00159 
00161     void releaseScratch();
00162 
00164     void adjustAtSeam();
00165 
00168     void setC0AtSeam(double weight);
00169 
00172     void setC1AtSeam(double weight);
00173 };
00174 
00175 }// end namespace Go
00176 
00177 #endif
Generated on Tue Sep 21 15:44:16 2010 for GoTools Core by  doxygen 1.6.3