nurbs_tools.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_TOOLS_H
00039 #define NURBS_TOOLS_H
00040 
00041 #include <pcl/surface/on_nurbs/nurbs_data.h>
00042 
00043 #include <pcl/surface/3rdparty/opennurbs/opennurbs.h>
00044 
00045 #undef Success
00046 #include <Eigen/Dense>
00047 
00048 namespace pcl
00049 {
00050   namespace on_nurbs
00051   {
00052 
00053     enum
00054     {
00055       NORTH = 1, NORTHEAST = 2, EAST = 3, SOUTHEAST = 4, SOUTH = 5, SOUTHWEST = 6, WEST = 7, NORTHWEST = 8
00056     };
00057 
00059     class NurbsTools
00060     {
00061     public:
00062 
00063       //      static std::list<unsigned>
00064       //      getClosestPoints (const Eigen::Vector2d &p, const vector_vec2d &data, unsigned s);
00065 
00069       static unsigned
00070       getClosestPoint (const Eigen::Vector2d &point, const vector_vec2d &data);
00071 
00075       static unsigned
00076       getClosestPoint (const Eigen::Vector3d &point, const vector_vec3d &data);
00077 
00084       static unsigned
00085       getClosestPoint (const Eigen::Vector2d &point, const Eigen::Vector2d &dir, const vector_vec2d &data,
00086                        unsigned &idxcp);
00087 
00090       static Eigen::Vector3d
00091       computeMean (const vector_vec3d &data);
00094       static Eigen::Vector2d
00095       computeMean (const vector_vec2d &data);
00096 
00099       static Eigen::Vector3d
00100       computeVariance (const Eigen::Vector3d &mean, const vector_vec3d &data);
00103       static Eigen::Vector2d
00104       computeVariance (const Eigen::Vector2d &mean, const vector_vec2d &data);
00105 
00107       static void
00108       computeBoundingBox (const ON_NurbsCurve &nurbs, Eigen::Vector3d &_min, Eigen::Vector3d &_max);
00109       static void
00110       computeBoundingBox (const ON_NurbsSurface &nurbs, Eigen::Vector3d &_min, Eigen::Vector3d &_max);
00111 
00112       static double
00113       computeRScale (const Eigen::Vector3d &_min, const Eigen::Vector3d &_max);
00114 
00120       static void
00121       pca (const vector_vec3d &data, Eigen::Vector3d &mean, Eigen::Matrix3d &eigenvectors,
00122            Eigen::Vector3d &eigenvalues);
00123 
00129       static void
00130       pca (const vector_vec2d &data, Eigen::Vector2d &mean, Eigen::Matrix2d &eigenvectors,
00131            Eigen::Vector2d &eigenvalues);
00132 
00137       static void
00138       downsample_random (const vector_vec3d &data1, vector_vec3d &data2, unsigned size);
00143       static void
00144       downsample_random (vector_vec3d &data1, unsigned size);
00145 
00146     };
00147 
00148   }
00149 }
00150 
00151 #endif /* NTOOLS_H_ */


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