Point Cloud Library (PCL)  1.3.1
texture_mapping.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2010, Willow Garage, 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 Willow Garage, Inc. 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  * $Id: texture_mapping.h 1005 2011-07-13 13:07:00 ktran $
00035  *
00036  */
00039 #ifndef PCL_SURFACE_TEXTURE_MAPPING_H_
00040 #define PCL_SURFACE_TEXTURE_MAPPING_H_
00041 
00042 #include "pcl/surface/reconstruction.h"
00043 #include "pcl/TextureMesh.h"
00044 
00045 namespace pcl
00046 {
00051   template <typename PointInT>
00052   class TextureMapping
00053   {
00054     public:
00056       TextureMapping (){};
00057 
00059       ~TextureMapping (){};
00060 
00064       inline void
00065       setF (float f)
00066       {
00067         f_ = f;
00068       };
00069 
00073       inline void
00074       setVectorField (float x, float y, float z)
00075       {
00076         vector_field_ =  Eigen::Vector3f(x, y, z);
00077         // normalize vector field
00078         vector_field_ = vector_field_/std::sqrt(vector_field_.dot(vector_field_));
00079       };
00080 
00084       inline void
00085       setTextureFiles (std::vector<std::string> tex_files)
00086       {
00087         tex_files_ = tex_files;
00088       };
00089 
00093       inline void
00094       setTextureMaterials (TexMaterial tex_material)
00095       {
00096         tex_material_ = tex_material;
00097       };
00098 
00102       void
00103       mapTexture2Mesh (pcl::TextureMesh &tex_mesh);
00104 
00108       void
00109       mapTexture2MeshUV (pcl::TextureMesh &tex_mesh);
00110 
00111     protected:
00112 
00114       float f_;
00115 
00117       Eigen::Vector3f vector_field_;
00118 
00120       std::vector<std::string> tex_files_;
00121 
00123       TexMaterial tex_material_;
00124 
00125 
00129       float
00130       getDistance (Eigen::Vector3f &p1, Eigen::Vector3f &p2);
00131 
00135       std::vector<Eigen::Vector2f>
00136       mapTexture2Face (Eigen::Vector3f  &p1, Eigen::Vector3f  &p2, Eigen::Vector3f &p3);
00137 
00139       std::string getClassName () const { return ("TextureMapping"); }
00140   };
00141 }
00142 
00143 #endif /* TEXTURE_MAPPING_H_ */
00144 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines