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 #include <iostream>
00039 #include <stdexcept>
00040
00041 #include <pcl/surface/on_nurbs/nurbs_solve.h>
00042
00043 using namespace std;
00044 using namespace pcl;
00045 using namespace on_nurbs;
00046
00047 void
00048 NurbsSolve::assign (unsigned rows, unsigned cols, unsigned dims)
00049 {
00050 m_Keig = Eigen::MatrixXd::Zero (rows, cols);
00051 m_xeig = Eigen::MatrixXd::Zero (cols, dims);
00052 m_feig = Eigen::MatrixXd::Zero (rows, dims);
00053 }
00054
00055 void
00056 NurbsSolve::K (unsigned i, unsigned j, double v)
00057 {
00058 m_Keig (i, j) = v;
00059 }
00060 void
00061 NurbsSolve::x (unsigned i, unsigned j, double v)
00062 {
00063 m_xeig (i, j) = v;
00064 }
00065 void
00066 NurbsSolve::f (unsigned i, unsigned j, double v)
00067 {
00068 m_feig (i, j) = v;
00069 }
00070
00071 double
00072 NurbsSolve::K (unsigned i, unsigned j)
00073 {
00074 return m_Keig (i, j);
00075 }
00076 double
00077 NurbsSolve::x (unsigned i, unsigned j)
00078 {
00079 return m_xeig (i, j);
00080 }
00081 double
00082 NurbsSolve::f (unsigned i, unsigned j)
00083 {
00084 return m_feig (i, j);
00085 }
00086
00087 void
00088 NurbsSolve::resize (unsigned rows)
00089 {
00090 m_feig.conservativeResize (rows, m_feig.cols ());
00091 m_Keig.conservativeResize (rows, m_Keig.cols ());
00092 }
00093
00094 void
00095 NurbsSolve::printK ()
00096 {
00097 for (unsigned r = 0; r < m_Keig.rows (); r++)
00098 {
00099 for (unsigned c = 0; c < m_Keig.cols (); c++)
00100 {
00101 printf (" %f", m_Keig (r, c));
00102 }
00103 printf ("\n");
00104 }
00105 }
00106
00107 void
00108 NurbsSolve::printX ()
00109 {
00110 for (unsigned r = 0; r < m_xeig.rows (); r++)
00111 {
00112 for (unsigned c = 0; c < m_xeig.cols (); c++)
00113 {
00114 printf (" %f", m_xeig (r, c));
00115 }
00116 printf ("\n");
00117 }
00118 }
00119
00120 void
00121 NurbsSolve::printF ()
00122 {
00123 for (unsigned r = 0; r < m_feig.rows (); r++)
00124 {
00125 for (unsigned c = 0; c < m_feig.cols (); c++)
00126 {
00127 printf (" %f", m_feig (r, c));
00128 }
00129 printf ("\n");
00130 }
00131 }
00132
00133 bool
00134 NurbsSolve::solve ()
00135 {
00136
00137
00138 m_xeig = m_Keig.jacobiSvd (Eigen::ComputeThinU | Eigen::ComputeThinV).solve (m_feig);
00139
00140 return true;
00141 }
00142
00143 Eigen::MatrixXd
00144 NurbsSolve::diff ()
00145 {
00146 Eigen::MatrixXd f (m_Keig * m_xeig);
00147 return (f - m_feig);
00148 }
00149