fitting_curve_pdm.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2012-, Open Perception, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of the copyright holder(s) nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * 
00035  *
00036  */
00037 
00038 #ifndef NURBS_FITTING_CURVE_PDM_H
00039 #define NURBS_FITTING_CURVE_PDM_H
00040 
00041 #include <pcl/pcl_exports.h>
00042 #include <pcl/surface/on_nurbs/nurbs_tools.h>
00043 #include <pcl/surface/on_nurbs/nurbs_data.h>
00044 #include <pcl/surface/on_nurbs/nurbs_solve.h>
00045 
00046 namespace pcl
00047 {
00048   namespace on_nurbs
00049   {
00050 
00057     class PCL_EXPORTS FittingCurve
00058     {
00059       public:
00060         struct Parameter
00061         {
00062           double smoothness;
00063           Parameter (double smoothness = 0.000001) :
00064             smoothness (smoothness)
00065           {
00066           }
00067         };
00068 
00069         ON_TextLog m_out;
00070         ON_NurbsCurve m_nurbs;
00071         NurbsDataCurve *m_data;
00072 
00077         FittingCurve (int order, NurbsDataCurve *data);
00078 
00083         FittingCurve (NurbsDataCurve *data, const ON_NurbsCurve &ns);
00084 
00090         static int
00091         findElement (double xi, const std::vector<double> &elements);
00092 
00094         void
00095         refine ();
00096 
00101         void
00102         assemble (const Parameter &parameter);
00103 
00107         void
00108         solve (double damp = 1.0);
00109 
00113         void
00114         updateCurve (double damp);
00115 
00121         static ON_NurbsCurve
00122         initNurbsCurve2D (int order, const vector_vec2d &data);
00123 
00129         static ON_NurbsCurve
00130         initNurbsCurvePCA (int order, const vector_vec3d &data, int ncps = 0, double rf = 1.0);
00131 
00144         static double
00145         inverseMapping (const ON_NurbsCurve &nurbs, const Eigen::Vector3d &pt, const double &hint, double &error,
00146                         Eigen::Vector3d &p, Eigen::Vector3d &t, int maxSteps = 100, double accuracy = 1e-6,
00147                         bool quiet = true);
00148 
00154         static double
00155         findClosestElementMidPoint (const ON_NurbsCurve &nurbs, const Eigen::Vector3d &pt);
00156 
00158         inline void
00159         setQuiet (bool val)
00160         {
00161           m_quiet = val;
00162           m_solver.setQuiet (val);
00163         }
00164 
00165       private:
00166 
00168         static std::vector<double>
00169         getElementVector (const ON_NurbsCurve &nurbs);
00170 
00172         void
00173         addPointConstraint (const double &param, const Eigen::Vector3d &point, double weight, unsigned &row);
00174 
00176         void
00177         addCageRegularisation (double weight, unsigned &row);
00178 
00180         void
00181         assembleInterior (double wInt, unsigned &row);
00182 
00183         NurbsSolve m_solver;
00184         bool m_quiet;
00185 
00186         int in_max_steps;
00187         double in_accuracy;
00188 
00189     };
00190   }
00191 }
00192 
00193 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:24:09