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_CYLINDER_H
00039 #define NURBS_FITTING_CYLINDER_H
00040
00041 #include <pcl/surface/on_nurbs/nurbs_tools.h>
00042 #include <pcl/surface/on_nurbs/nurbs_data.h>
00043 #include <pcl/surface/on_nurbs/nurbs_solve.h>
00044
00045 namespace pcl
00046 {
00047 namespace on_nurbs
00048 {
00049
00055 class FittingCylinder
00056 {
00057 public:
00058
00059 ON_TextLog m_out;
00060 ON_NurbsSurface m_nurbs;
00061 NurbsDataSurface *m_data;
00062
00067 FittingCylinder (int order, NurbsDataSurface *data);
00068
00072 FittingCylinder (NurbsDataSurface *data, const ON_NurbsSurface &ns);
00073
00076 void
00077 refine (int dim);
00078
00082 void
00083 refine (int dim, double param);
00084
00088 void
00089 refine (int dim, unsigned span_index);
00090
00094 void
00095 assemble (double smoothness = 0.000001f);
00096
00099 void
00100 solve (double damp = 1.0);
00101
00104 void
00105 updateSurf (double damp);
00106
00110 void
00111 setInvMapParams (int in_max_steps, double invMapInt_accuracy);
00112
00113 inline void
00114 setQuiet (bool val)
00115 {
00116 m_quiet = val;
00117 m_solver.setQuiet(val);
00118 }
00119
00121 static ON_NurbsSurface
00122 initNurbsPCACylinder (int order, NurbsDataSurface *data);
00123
00125 static std::vector<double>
00126 getElementVector (const ON_NurbsSurface &nurbs, int dim);
00127
00141 static Eigen::Vector2d
00142 inverseMapping (const ON_NurbsSurface &nurbs, const Eigen::Vector3d &pt, const Eigen::Vector2d &hint,
00143 double &error, Eigen::Vector3d &p, Eigen::Vector3d &tu, Eigen::Vector3d &tv, int maxSteps = 100,
00144 double accuracy = 1e-6, bool quiet = true);
00145
00150 static Eigen::Vector2d
00151 findClosestElementMidPoint (const ON_NurbsSurface &nurbs, const Eigen::Vector3d &pt);
00152
00153 protected:
00154
00156 void
00157 init ();
00158
00160 void
00161 assembleInterior (double wInt, unsigned &row);
00162
00164 void
00165 addPointConstraint (const Eigen::Vector2d ¶ms, const Eigen::Vector3d &point, double weight, unsigned &row);
00166
00168 void
00169 addCageInteriorRegularisation (double weight, unsigned &row);
00170
00172 void
00173 addCageBoundaryRegularisation (double weight, int side, unsigned &row);
00174
00175 private:
00176 NurbsSolve m_solver;
00177 bool m_quiet;
00178
00179 int in_max_steps;
00180 double in_accuracy;
00181
00182
00183 int
00184 grc2gl (int I, int J)
00185 {
00186 int cp_red = (m_nurbs.m_order[1] - 2);
00187 int ncpj = (m_nurbs.m_cv_count[1] - 2 * cp_red);
00188 return ncpj * I + (J % ncpj);
00189 }
00190 int
00191 lrc2gl (int E, int F, int i, int j)
00192 {
00193 return grc2gl (E + i, F + j);
00194 }
00195 int
00196 gl2gr (int A)
00197 {
00198 return (A / m_nurbs.CVCount (1));
00199 }
00200 int
00201 gl2gc (int A)
00202 {
00203 return (A % m_nurbs.CVCount (1));
00204 }
00205
00206 };
00207
00208 }
00209 }
00210
00211 #endif