00001 #ifndef _FUNCTIONS_HPP_
00002 #define _FUNCTIONS_HPP_
00003
00004 #include <vector>
00005 #include "jmath/jblas.hpp"
00006
00007 #include "facetsmap/types.hpp"
00008
00009 namespace jafar {
00010 namespace facetsmap {
00011
00012 inline jblas::mat66 vecprodtransvec(const jblas::vec& v)
00013 {
00014 jblas::mat66 m = ublas::zero_matrix<double> (6, 6);
00015 for(int i =0; i < 6; i++)
00016 {
00017 for(int j =0; j < 6; j++)
00018 {
00019 m(i,j) = v(i) * v(j);
00020 }
00021 }
00022 return m;
00023 }
00024
00025 inline void rImage2rStereo(jblas::vec3& v)
00026 {
00027 double x=v(0);
00028 v(0) = v(2);
00029 v(2) = -v(1);
00030 v(1) = -x;
00031 }
00032
00033 inline void rStereo2rImage(jblas::vec3& v)
00034 {
00035 double x=v(0);
00036 v(0) = -v(1);
00037 v(1) = -v(2);
00038 v(2) = x;
00039 }
00040
00045 template<class PointType>
00046 std::vector<double> findParamBestPlan(std::vector<PointType> points);
00047
00048 void eraseVFacets(jafar::facetsmap::vFacets& v);
00049
00057 template<class PointType, int p1, int p2, int p3>
00058 std::vector<double> findParamPlan(std::vector<PointType>);
00059
00065 template <class vectType>
00066 jblas::vec3 orthogonalProjection(jblas::vec3 normal, double d, vectType& vect);
00067
00070 template <int dim, class RT, class C1 = RT, class C2 = C1>
00071 class vect_op {
00072 public:
00073 inline static RT dot_product (C1 premier, C2 second);
00074 inline static RT sub(C1,C2);
00075 inline static RT vectorial_product(C1,C2);
00076 };
00077
00078 template <class RT, class C1, class C2>
00079 class vect_op<1,RT, C1, C2> {
00080 public:
00081 inline static RT dot_product (C1 premier, C2 second);
00082 inline static RT sub(C1,C2);
00083 };
00084 inline jblas::vec3 prodMat44byVec3(jblas::mat44 m, jblas::vec3 v, double l)
00085 {
00086 jblas::vec3 ret;
00087 ret(0) = m(0,0) * v(0) + m(0,1) * v(1) + m(0,2) * v(2) + m(0,3) *l;
00088 ret(1) = m(1,0) * v(0) + m(1,1) * v(1) + m(1,2) * v(2) + m(1,3) *l;
00089 ret(2) = m(2,0) * v(0) + m(2,1) * v(1) + m(2,2) * v(2) + m(2,3) *l;
00090 return ret;
00091 };
00092 };
00093 };
00094
00095 #include "functions.tpp"
00096
00097 #endif