nurbs_solve.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_SOLVE_H_
00039 #define _NURBS_SOLVE_H_
00040 
00041 #undef Success
00042 #include <Eigen/Dense>
00043 
00044 #include <pcl/surface/on_nurbs/sparse_mat.h>
00045 
00046 namespace pcl
00047 {
00048   namespace on_nurbs
00049   {
00050 
00053     class NurbsSolve
00054     {
00055     public:
00057       NurbsSolve () :
00058         m_quiet (true)
00059       {
00060       }
00061 
00063       void
00064       assign (unsigned rows, unsigned cols, unsigned dims);
00065 
00067       void
00068       K (unsigned i, unsigned j, double v);
00070       void
00071       x (unsigned i, unsigned j, double v);
00073       void
00074       f (unsigned i, unsigned j, double v);
00075 
00077       double
00078       K (unsigned i, unsigned j);
00080       double
00081       x (unsigned i, unsigned j);
00083       double
00084       f (unsigned i, unsigned j);
00085 
00087       void
00088       resize (unsigned rows);
00089 
00091       void
00092       printK ();
00094       void
00095       printX ();
00097       void
00098       printF ();
00099 
00102       bool
00103       solve ();
00104 
00106       Eigen::MatrixXd
00107       diff ();
00108 
00110       inline void
00111       setQuiet (bool val)
00112       {
00113         m_quiet = val;
00114       }
00115 
00117       inline void
00118       getSize (unsigned &rows, unsigned &cols, unsigned &dims)
00119       {
00120         rows = static_cast<unsigned>(m_feig.rows());
00121         cols = static_cast<unsigned>(m_xeig.rows());
00122         dims = static_cast<unsigned>(m_feig.cols());
00123       }
00124 
00125     private:
00126       bool m_quiet;
00127       SparseMat m_Ksparse;
00128       Eigen::MatrixXd m_Keig;
00129       Eigen::MatrixXd m_xeig;
00130       Eigen::MatrixXd m_feig;
00131 
00132     public:
00133       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00134     };
00135 
00136   }
00137 }
00138 
00139 #endif


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