|  |  | @ -4,6 +4,35 @@ | 
			
		
	
		
			
				
					|  |  |  | #include <ostream> | 
			
		
	
		
			
				
					|  |  |  | #include <cmath> | 
			
		
	
		
			
				
					|  |  |  | #include "Mat.h" | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * @addtogroup math | 
			
		
	
		
			
				
					|  |  |  |  * @{ | 
			
		
	
		
			
				
					|  |  |  |  * @author  Philipp Schoenberger <ph.schoenberger@googlemail.com> | 
			
		
	
		
			
				
					|  |  |  |  * @version 2.0 | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * @section LICENSE | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * This program is free software; you can redistribute it and/or | 
			
		
	
		
			
				
					|  |  |  |  * modify it under the terms of the GNU General Public License as | 
			
		
	
		
			
				
					|  |  |  |  * published by the Free Software Foundation; either version 2 of | 
			
		
	
		
			
				
					|  |  |  |  * the License, or (at your option) any later version. | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * This program is distributed in the hope that it will be useful, but | 
			
		
	
		
			
				
					|  |  |  |  * WITHOUT ANY WARRANTY; without even the implied warranty of | 
			
		
	
		
			
				
					|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 
			
		
	
		
			
				
					|  |  |  |  * General Public License for more details at | 
			
		
	
		
			
				
					|  |  |  |  * https://www.gnu.org/copyleft/gpl.html | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * @section DESCRIPTION | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * This file contains the Trajectory for a linear trajectory | 
			
		
	
		
			
				
					|  |  |  |  * The linear trajectory only uses the max speed and ignores | 
			
		
	
		
			
				
					|  |  |  |  * the acceleration parameter. | 
			
		
	
		
			
				
					|  |  |  |  * The movement is a strict hard acceleration and deacceration. | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * The slowest joint is defining the speed of the other joints. | 
			
		
	
		
			
				
					|  |  |  |  * By that all joints start and stop the movement synchronously | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | template<class T, unsigned SIZE> class Vec; | 
			
		
	
		
			
				
					|  |  |  | template <class T, unsigned SIZE> class Mat; | 
			
		
	
	
		
			
				
					|  |  | @ -113,7 +142,7 @@ public: | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * assignment operator between vectors | 
			
		
	
		
			
				
					|  |  |  |      * also capabile of muilti asignments  | 
			
		
	
		
			
				
					|  |  |  |      * also capable of multi assignments  | 
			
		
	
		
			
				
					|  |  |  |      * e.g:  | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * vec1    =       vec2      = vec3; | 
			
		
	
	
		
			
				
					|  |  | @ -139,6 +168,17 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return (*this);  | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * assignment operator between simple types | 
			
		
	
		
			
				
					|  |  |  |      * also capable of multi assignments  | 
			
		
	
		
			
				
					|  |  |  |      * e.g:  | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * vec1    =       vec2      = vec3; | 
			
		
	
		
			
				
					|  |  |  |      * L-Value = R-Value/L-Value = R-Value | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param atData the source data array which should be copied | 
			
		
	
		
			
				
					|  |  |  |      * @retval returns the current  | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> &operator = (const T atData[SIZE])  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         for (unsigned int i=0; i<SIZE; i++) // not me, so L-Value action: copy data | 
			
		
	
	
		
			
				
					|  |  | @ -150,10 +190,16 @@ public: | 
			
		
	
		
			
				
					|  |  |  |                         //   "   =   "   + (L-Val = R-Val) | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // usage of operator: | 
			
		
	
		
			
				
					|  |  |  |     // vec(i) = var;    // 0 <= i <= SIZE-1 | 
			
		
	
		
			
				
					|  |  |  |     // var = vec(i); | 
			
		
	
		
			
				
					|  |  |  |     // vec1(i) = vec2(j); | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions requests the cell with a defined index | 
			
		
	
		
			
				
					|  |  |  |      * usage of operator: | 
			
		
	
		
			
				
					|  |  |  |      * vec(i) = var;    // 0 <= i <= SIZE-1 | 
			
		
	
		
			
				
					|  |  |  |      * var = vec(i); | 
			
		
	
		
			
				
					|  |  |  |      * vec1(i) = vec2(j); | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param i the index of the vector | 
			
		
	
		
			
				
					|  |  |  |      * @retval returns the cell with the provided index | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     T &operator () (unsigned i)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         if (i>=SIZE) | 
			
		
	
	
		
			
				
					|  |  | @ -161,6 +207,16 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return m_atData[i];         // ... so we can safely return a reference | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions requests the cell with a defined index | 
			
		
	
		
			
				
					|  |  |  |      * usage of operator: | 
			
		
	
		
			
				
					|  |  |  |      * vec(i) = var;    // 0 <= i <= SIZE-1 | 
			
		
	
		
			
				
					|  |  |  |      * var = vec(i); | 
			
		
	
		
			
				
					|  |  |  |      * vec1(i) = vec2(j); | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param i the index of the vector | 
			
		
	
		
			
				
					|  |  |  |      * @retval returns the cell with the provided index | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     T operator () (unsigned i) const  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         if (i>=SIZE) | 
			
		
	
	
		
			
				
					|  |  | @ -168,12 +224,25 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return m_atData[i]; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to adds the vector by  | 
			
		
	
		
			
				
					|  |  |  |      * an other vector and reasign it. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param vec the vector to add to the current instance | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     void operator += (const Vec<T, SIZE> &vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         for (int i=0; i<SIZE; i++) | 
			
		
	
		
			
				
					|  |  |  |             m_atData[i] += vec.m_atData[i]; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to adds the vector by  | 
			
		
	
		
			
				
					|  |  |  |      * an other vector. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param vec the vector to add to the current instance | 
			
		
	
		
			
				
					|  |  |  |      * @return the calculated vector | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> operator + (const Vec<T, SIZE> &vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buf (m_atData); | 
			
		
	
	
		
			
				
					|  |  | @ -182,14 +251,25 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return buf; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to subtract the vector by  | 
			
		
	
		
			
				
					|  |  |  |      * an other vector.and reasign it | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param vec the vector to subtract to the current instance | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     void operator -= (const Vec<T, SIZE> &vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         for (unsigned int i=0; i<SIZE; i++) | 
			
		
	
		
			
				
					|  |  |  |             m_atData[i] -= vec.m_atData[i]; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // binary - | 
			
		
	
		
			
				
					|  |  |  |     // vec1 - vec2 i.e. (*this) - vec | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to subtract the vector by  | 
			
		
	
		
			
				
					|  |  |  |      * an other vector. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param vec the vector to subtract to the current instance | 
			
		
	
		
			
				
					|  |  |  |      * @return the calculated vector | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> operator - (const Vec<T, SIZE> &vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buf (m_atData); | 
			
		
	
	
		
			
				
					|  |  | @ -198,8 +278,12 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return buf; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // unary - | 
			
		
	
		
			
				
					|  |  |  |     // -vec i.e. -(*this) | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to calculate the negative vector | 
			
		
	
		
			
				
					|  |  |  |      * of the current one | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the negative vector | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> operator - ()  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         T atBuffer[SIZE]; | 
			
		
	
	
		
			
				
					|  |  | @ -208,6 +292,13 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return Vec<T, SIZE> (atBuffer); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to multiply the vector by  | 
			
		
	
		
			
				
					|  |  |  |      * an other vector. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param vec the vector to multiply to the current instance | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector product | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     T operator * (const Vec<T, SIZE> & vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         T dp = T(0); | 
			
		
	
	
		
			
				
					|  |  | @ -216,12 +307,25 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return dp; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to multiply the vector by the simple type | 
			
		
	
		
			
				
					|  |  |  |      * provided and reasign it. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param tscale the simple type | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     void operator *= (T tScale)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         for (unsigned int i=0; i<SIZE; i++) | 
			
		
	
		
			
				
					|  |  |  |             m_atData[i] *= tScale; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to multiply the vector by the simple type | 
			
		
	
		
			
				
					|  |  |  |      * provided  | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param tscale the simple type | 
			
		
	
		
			
				
					|  |  |  |      * @return the new calculated matrix | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> operator * (T tScale)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> vec; | 
			
		
	
	
		
			
				
					|  |  | @ -229,6 +333,14 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             vec(i) = m_atData[i]*tScale; | 
			
		
	
		
			
				
					|  |  |  |         return vec; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * operator to divide the vector by the simple type | 
			
		
	
		
			
				
					|  |  |  |      * provided  | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param tscale the simple type | 
			
		
	
		
			
				
					|  |  |  |      * @return the new calculated matrix | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> operator / (T tScale)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> vec; | 
			
		
	
	
		
			
				
					|  |  | @ -237,6 +349,15 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return vec; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns from the current and  | 
			
		
	
		
			
				
					|  |  |  |      * the provided vector the vector division | 
			
		
	
		
			
				
					|  |  |  |      * for each cell separately | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the operator/ function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the cell wise divisor | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> operator * (const Mat<T, SIZE> &mat) | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> vec; | 
			
		
	
	
		
			
				
					|  |  | @ -246,6 +367,16 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return vec; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns from the current and  | 
			
		
	
		
			
				
					|  |  |  |      * the provided vector the vector division | 
			
		
	
		
			
				
					|  |  |  |      * for each cell separately | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the operator/ function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @pram vec the vector to divide the current vector | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the cell wise divisor | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> celldivide (const Vec<T, SIZE> & vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -253,6 +384,17 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             buff.m_atData[i] = m_atData[i]/vec.m_atData[i]; | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns from the current and  | 
			
		
	
		
			
				
					|  |  |  |      * the provided vector the vector multiplication  | 
			
		
	
		
			
				
					|  |  |  |      * for each cell separately | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the operator* function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @pram vec the vector to multiply the current vector | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the cell wise product | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> cellmultiply (const Vec<T, SIZE> & vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -260,6 +402,15 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             buff.m_atData[i] = m_atData[i]*vec.m_atData[i]; | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns from the current and  | 
			
		
	
		
			
				
					|  |  |  |      * the provided vector the minimum for each cell | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the min function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the minimum cells in each dimension | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> cellmin(const Vec<T, SIZE> & vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -267,6 +418,15 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             buff.m_atData[i] = std::min(m_atData[i],vec.m_atData[i]); | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns from the current and  | 
			
		
	
		
			
				
					|  |  |  |      * the provided vector the maximum for each cell | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the max function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the maximum cells in each dimension | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> cellmax(const Vec<T, SIZE> & vec)  | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -275,6 +435,14 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions calculates the absolute value | 
			
		
	
		
			
				
					|  |  |  |      * for each cell. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the abs function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the absolute values | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> abs () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -283,6 +451,14 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions calculates the square root | 
			
		
	
		
			
				
					|  |  |  |      * for each cell. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the sqrt function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the square root values | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> sqrt() | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -290,6 +466,15 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             buff.m_atData[i] = std::sqrt(m_atData[i]); | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions calculates the floor | 
			
		
	
		
			
				
					|  |  |  |      * for each cell. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the floor function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the floor values | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> floor () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -297,6 +482,15 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             buff.m_atData[i] = floor(m_atData[i]); | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions calculates the ceil | 
			
		
	
		
			
				
					|  |  |  |      * for each cell. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the ceil function has to be implemented for the template type | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector containing the ceil values | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> ceil () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -304,6 +498,14 @@ public: | 
			
		
	
		
			
				
					|  |  |  |             buff.m_atData[i] = std::ceil(m_atData[i]); | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions is here for the float simple type | 
			
		
	
		
			
				
					|  |  |  |      * to calculate the sgn | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param x the float value to check | 
			
		
	
		
			
				
					|  |  |  |      * @return the sign of the provided float | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     float sgn(float x)  | 
			
		
	
		
			
				
					|  |  |  |     {  | 
			
		
	
		
			
				
					|  |  |  |         if ( x == 0 )  | 
			
		
	
	
		
			
				
					|  |  | @ -314,6 +516,14 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         else | 
			
		
	
		
			
				
					|  |  |  |             return -1.0f;  | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns the vector containing the  | 
			
		
	
		
			
				
					|  |  |  |      * sign for each cell. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the Template type has to provide the sgn function | 
			
		
	
		
			
				
					|  |  |  |      * @return the vector with all signs | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> sgn () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         Vec<T, SIZE> buff; | 
			
		
	
	
		
			
				
					|  |  | @ -322,6 +532,12 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return buff; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns the maximum cell of the vector. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the Template type has to provide the operator> | 
			
		
	
		
			
				
					|  |  |  |      * @return the maximum cell | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     T max () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         T retval = m_atData[0]; | 
			
		
	
	
		
			
				
					|  |  | @ -332,6 +548,13 @@ public: | 
			
		
	
		
			
				
					|  |  |  |                 retval =  m_atData[i]; | 
			
		
	
		
			
				
					|  |  |  |         return retval; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions returns the minimum cell of the vector. | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the Template type has to provide the operator> | 
			
		
	
		
			
				
					|  |  |  |      * @return the minimum cell | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     T min () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         T retval = m_atData[0]; | 
			
		
	
	
		
			
				
					|  |  | @ -343,6 +566,12 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return retval; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions calculates the norm of the vector | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @info the Template type has to provide the sqrt function | 
			
		
	
		
			
				
					|  |  |  |      * @return the normalisation factor | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     T norm () | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         T retval = 0; | 
			
		
	
	
		
			
				
					|  |  | @ -354,6 +583,13 @@ public: | 
			
		
	
		
			
				
					|  |  |  |         return retval; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * This functions calculates the cross product of 2 vectors. | 
			
		
	
		
			
				
					|  |  |  |      *  | 
			
		
	
		
			
				
					|  |  |  |      * @param vec the 2th vector for the cross product | 
			
		
	
		
			
				
					|  |  |  |      * @return the cross product | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     Vec<T, SIZE> x(const Vec<T, SIZE> &vec) | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         T temp[SIZE]; | 
			
		
	
	
		
			
				
					|  |  | @ -389,6 +625,14 @@ typedef Vec<bool, 3> Vec3b; | 
			
		
	
		
			
				
					|  |  |  | typedef Vec<bool, 4> Vec4b; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * This function is used for the standard output stream and converts | 
			
		
	
		
			
				
					|  |  |  |  * the vector to a string. | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * @param output the outputstream which should be extended by the vector | 
			
		
	
		
			
				
					|  |  |  |  * @param vec    the vector which should be printed to the output stream | 
			
		
	
		
			
				
					|  |  |  |  * @return the changed output stream to be capable of something like "cout<<"test" << matrix;" | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | template <class T, unsigned SIZE> | 
			
		
	
		
			
				
					|  |  |  | static std::ostream& operator<< (std::ostream& output,const Vec<T,SIZE> &vec) | 
			
		
	
		
			
				
					|  |  |  | { | 
			
		
	
	
		
			
				
					|  |  | @ -404,4 +648,7 @@ static std::ostream& operator<< (std::ostream& output,const Vec<T,SIZE> &vec) | 
			
		
	
		
			
				
					|  |  |  |     return output; | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * @} | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | #endif |