Kiretu
|
00001 /* This file is part of the Kiretu, a Kinect reconstruction tutor. 00002 * 00003 * http://pille.iwr.uni-heidelberg.de/~kinect01/ 00004 * 00005 * The code ist licensed to you under the terms of the GNU General Public 00006 * License, version 2.0. See the GPL2 file for the text of the license or the 00007 * following URL: 00008 * 00009 * http://www.gnu.org/licenses/gpl-2.0.txt 00010 * 00011 * If you redistribute this file in source form, modified or unmodified, you 00012 * have to leave this header intact and distribute it under the same terms with 00013 * the GPL2 file. 00014 * 00015 * Binary distributions must follow the binary distribution requirements of 00016 * the License. 00017 * 00018 */ 00019 00020 /** \file Util.h 00021 * 00022 * Util.h contains some often used functions. 00023 * 00024 * \author Daniel Wunderlich (d.wunderlich@stud.uni-heidelberg.de) 00025 * \version 0.8 00026 * \date 2011-01-26 00027 */ 00028 00029 #include <vector> 00030 #include <iostream> 00031 #include <sstream> 00032 #include <string> 00033 00034 // Conversion utilities 00035 00036 /** \brief Converts a string to float. 00037 * 00038 * \param str The string, which should be converted. 00039 * 00040 * \return The converted float. 00041 */ 00042 float strToFloat(std::string &str); 00043 00044 std::string intToStr(int i); 00045 00046 00047 // Vector/Matrix utilities 00048 00049 /** \brief Prints the given vector to the standard-output. 00050 * 00051 * \param vec The vector, which should be printed. 00052 */ 00053 void printVec(std::vector<float> &vec); 00054 00055 00056 /** \brief Prints the given matrix to the standard-output. 00057 * 00058 * \param mat The matrix, which should be printed. 00059 */ 00060 void printMat(std::vector< std::vector<float> > &mat); 00061 00062 00063 /** \brief Multiplies the matrix mat with the vector vec and saves the result in 00064 * the vector res. 00065 * 00066 * \param mat The matrix, which should be multiplied. 00067 * \param vec The vector, which should be multiplied. 00068 * \param res The vector the result should be saved in. 00069 */ 00070 void matMult(std::vector< std::vector<float> > &mat, std::vector<float> &vec, std::vector<float> &res); 00071 00072 00073 /** \brief Adds the vectores vec1 and vec2 and saves the result in the vector 00074 * res. 00075 * 00076 * \param vec1 The first vector, which should be added. 00077 * \param vec2 The second vector, which should be added. 00078 * \param res The vector the result should be saved in. 00079 */ 00080 void vecAdd(std::vector<float> &vec1, std::vector<float> &vec2, std::vector<float> &res);