00001 // This is core/vnl/vnl_cross_product_matrix.h 00002 #ifndef vnl_cross_product_matrix_h_ 00003 #define vnl_cross_product_matrix_h_ 00004 //: 00005 // \file 00006 // \brief 3x3 cross-product matrix of vector 00007 // \author Andrew W. Fitzgibbon, Oxford RRG 00008 // \date 19 Sep 96 00009 // 00010 // \verbatim 00011 // Modifications 00012 // 4/4/01 LSB (Manchester) Tidied Documentation 00013 // 27 June 2003 - Peter Vanroose - made set() inlined and removed .cxx file. 00014 // \endverbatim 00015 // 00016 //----------------------------------------------------------------------------- 00017 00018 #include <vnl/vnl_double_3x3.h> 00019 00020 //: Calculates the 3x3 skew symmetric cross product matrix from a vector. 00021 // 00022 // vnl_cross_product_matrix(e) is the matrix [e]_ x: 00023 // \verbatim 00024 // 0 -e_3 e_2 00025 // e_3 0 -e_1 00026 // -e_2 e_1 0 00027 // \endverbatim 00028 class vnl_cross_product_matrix : public vnl_double_3x3 00029 { 00030 public: 00031 typedef vnl_double_3x3 base; 00032 00033 vnl_cross_product_matrix(const vnl_vector<double>& v) { set(v.data_block()); } 00034 vnl_cross_product_matrix(const double* v) { set(v); } 00035 vnl_cross_product_matrix(const vnl_cross_product_matrix& that): base(that) {} 00036 ~vnl_cross_product_matrix() {} 00037 00038 vnl_cross_product_matrix& operator=(const vnl_cross_product_matrix& that) { 00039 base::operator= (that); 00040 return *this; 00041 } 00042 00043 //: Construct a vnl_cross_product_matrix from a C-array of 3 doubles. 00044 // Overrides a method in vnl_matrix. 00045 inline void set(const double* v) 00046 { 00047 double const& e1 = v[0]; 00048 double const& e2 = v[1]; 00049 double const& e3 = v[2]; 00050 00051 vnl_cross_product_matrix & E = *this; 00052 00053 E(0,0) = 0; E(0,1) = -e3; E(0,2) = e2; 00054 E(1,0) = e3; E(1,1) = 0; E(1,2) = -e1; 00055 E(2,0) = -e2; E(2,1) = e1; E(2,2) = 0; 00056 } 00057 }; 00058 00059 #endif // vnl_cross_product_matrix_h_
1.5.1