inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/a3d
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_a3d
00005 #define inlib_a3d
00006 
00007 #include "a3"
00008 
00009 namespace inlib {
00010 namespace a3d {
00011 
00012 class vec : public a3::vec<double> {
00013 public:
00014   vec(): a3::vec<double>() {}
00015   vec(const double a_vec[3]): a3::vec<double>(a_vec) {}
00016   vec(const double& a0,const double& a1,const double& a2)
00017   : a3::vec<double>(a0,a1,a2){}
00018   virtual ~vec() {}
00019 public:
00020   vec(const vec& a_from): a3::vec<double>(a_from){}
00021   vec& operator=(const vec& a_from){
00022     a3::vec<double>::operator=(a_from);
00023     return *this;
00024   }
00025 public:
00026 /*
00027   double length() const {
00028     return ::sqrt(m_vector[0] * m_vector[0] + 
00029                   m_vector[1] * m_vector[1] + 
00030                   m_vector[2] * m_vector[2]); 
00031   }
00032   double normalize() {
00033     double norme = length();
00034     if(norme==0) return 0;
00035     divide(norme);
00036     return norme;
00037   }
00038   double dot(const vec& aV) const {
00039     return (m_vector[0] * aV.m_vector[0] + 
00040             m_vector[1] * aV.m_vector[1] + 
00041             m_vector[2] * aV.m_vector[2]);
00042   }    
00043 */
00044   vec cross(const vec& aV) const {
00045     return vec(m_vector[1] * aV.m_vector[2] - m_vector[2] * aV.m_vector[1],
00046                m_vector[2] * aV.m_vector[0] - m_vector[0] * aV.m_vector[2],
00047                m_vector[0] * aV.m_vector[1] - m_vector[1] * aV.m_vector[0]);
00048   }    
00049 };
00050 
00054 
00055 //  1  0  0
00056 //  0  1  0
00057 //  0  0  1
00058 class id : public a3::sqm<double> {
00059 public:
00060   id(){
00061     v00(1);
00062     v11(1);
00063     v22(1);
00064   }
00065 };
00066 
00067 // Generators of rotation group :
00068 // Rk(i,j) = epsilon(k,i,j)  i,j,k=1,2,3
00069 //  0  0  0
00070 //  0  0  1
00071 //  0 -1  0
00072 class R1 : public a3::sqm<double> {
00073 public:
00074   R1(){
00075     v12( 1);
00076     v21(-1);
00077   }
00078 };
00079 //  0  0 -1
00080 //  0  0  0
00081 //  1  0  0
00082 class R2 : public a3::sqm<double> {
00083 public:
00084   R2(){
00085     v02(-1);
00086     v20( 1);
00087   }
00088 };
00089 //  0  1  0
00090 // -1  0  0
00091 //  0  0  0
00092 class R3 : public a3::sqm<double> {
00093 public:
00094   R3(){
00095     v01( 1);
00096     v10(-1);
00097   }
00098 };
00099 
00100 // Levi-Civita indicator :
00101 class epsilon : public a3::cbm<double> {
00102 public:
00103   epsilon(){
00104     v210(-1);
00105     v120( 1);
00106     v201( 1);
00107     v021(-1);
00108     v102(-1);
00109     v012( 1);
00110   }
00111 };
00112 
00113 }}
00114 
00115 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines