Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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 ¶meter);
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 ¶m, 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