HyperspaceExplorer 0.7.1
SinglethreadedTransformation.impl.h
00001 /* 
00002  * File:   SinglethreadedTransformation.impl.h
00003  * Author: lene
00004  *
00005  * Created on March 30, 2012, 5:52 PM
00006  */
00007 
00008 #ifndef SINGLETHREADEDTRANSFORMATION_IMPL_H
00009 #define SINGLETHREADEDTRANSFORMATION_IMPL_H
00010 
00011 #include "SinglethreadedTransformation.h"
00012 
00013 template <unsigned N, unsigned P, typename NUM>
00014 SinglethreadedTransformation<N, P, NUM>::SinglethreadedTransformation(
00015         const VecMath::Rotation<N, NUM> &rotation,
00016         const VecMath::Vector<N, NUM> &translation,
00017         const VecMath::Vector<N, NUM> &scale): 
00018   TransformationImpl<N, P, NUM>(rotation, translation, scale) { }
00019 
00020 template <unsigned N, typename NUM>
00021 SinglethreadedTransformation<N, 1, NUM>::SinglethreadedTransformation(
00022         const VecMath::Rotation<N, NUM> &rotation,
00023         const VecMath::Vector<N, NUM> &translation,
00024         const VecMath::Vector<N, NUM> &scale): 
00025   TransformationImpl<N, 1, NUM>(rotation, translation, scale) { }
00026 
00027 template <unsigned N, unsigned P, typename NUM>
00028 typename SinglethreadedTransformation<N, P, NUM>::value_storage_type
00029 SinglethreadedTransformation<N, P, NUM>::transform(
00030   const value_storage_type &x) const {
00031     
00032     value_storage_type xtrans(x.size());
00033     
00034     SinglethreadedTransformation<N, P-1, NUM> transformation(
00035         TransformationImpl<N, P, NUM>::rotation_, 
00036         TransformationImpl<N, P, NUM>::translation_, 
00037         TransformationImpl<N, P, NUM>::scale_
00038     );
00039 
00040     for(unsigned i = 0; i != x.size(); ++i) {
00041         xtrans[i] = transformation.transform(x[i]);
00042     }
00043     
00044     return xtrans;
00045 }
00046 
00047 template <unsigned N, typename NUM>
00048 typename SinglethreadedTransformation<N, 1, NUM>::value_storage_type
00049 SinglethreadedTransformation<N, 1, NUM>::transform(
00050   const value_storage_type &x) const {
00051     value_storage_type xtrans(x.size());
00052 
00053     for(unsigned i = 0; i != x.size(); ++i) {
00054         xtrans[i] = perform(
00055                 x[i],
00056                 TransformationImpl<N, 1, NUM>::rotation_, 
00057                 TransformationImpl<N, 1, NUM>::translation_, 
00058                 TransformationImpl<N, 1, NUM>::scale_                
00059         );
00060     }
00061     return xtrans;
00062 }
00063 
00064 #endif  /* SINGLETHREADEDTRANSFORMATION_IMPL_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:16 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo