Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/sf_mat4f is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_sf_mat4f
0005 #define tools_sg_sf_mat4f
0006 
0007 #include "sf_vec"
0008 
0009 #include "../lina/mat4f"
0010 #include "../lina/vec3f"
0011 #include "../lina/rotf"
0012 
0013 #include "../HEADER"
0014 
0015 namespace tools {
0016 namespace sg {
0017 
0018 class sf_mat4f : public sf_vec<mat4f,float> {
0019   typedef sf_vec<mat4f,float> pr;
0020   TOOLS_HEADER(sf_mat4f,tools::sg::sf_mat4f,pr)
0021 public:
0022   sf_mat4f():parent(){}
0023   sf_mat4f(const mat4f& a_value):parent(a_value){}
0024   virtual ~sf_mat4f(){}
0025 public:
0026   sf_mat4f(const sf_mat4f& a_from):parent(a_from){}
0027   sf_mat4f& operator=(const sf_mat4f& a_from){
0028     parent::operator=(a_from);
0029     return *this;
0030   }
0031 public:
0032   sf_mat4f& operator=(const mat4f& a_value){
0033     parent::operator=(a_value);
0034     return *this;
0035   }
0036 public:
0037   void set_identity() {
0038     m_value.set_identity();
0039     m_touched = true;
0040   }
0041   void set_translate(float a_x,float a_y,float a_z) {
0042     m_value.set_translate(a_x,a_y,a_z);
0043     m_touched = true; //FIXME : should check for a change !
0044   }
0045   void set_translate(const vec3f& a_v) {
0046     m_value.set_translate(a_v.x(),a_v.y(),a_v.z());
0047     m_touched = true; //FIXME : should check for a change !
0048   }
0049   void set_scale(float a_x,float a_y,float a_z) {
0050     m_value.set_scale(a_x,a_y,a_z);
0051     m_touched = true; //FIXME : should check for a change !
0052   }
0053   void set_scale(float a_s) {
0054     m_value.set_scale(a_s);
0055     m_touched = true; //FIXME : should check for a change !
0056   }
0057   void set_rotate(float a_x,float a_y,float a_z,float a_angle) {
0058     m_value.set_rotate(a_x,a_y,a_z,a_angle);
0059     m_touched = true; //FIXME : should check for a change !
0060   }
0061   void set_rotate(const vec3f& a_v,float a_angle) {
0062     m_value.set_rotate(a_v.x(),a_v.y(),a_v.z(),a_angle);
0063     m_touched = true; //FIXME : should check for a change !
0064   }
0065 
0066   void mul_mtx(const mat4f& a_m,float a_tmp[]) {
0067     m_value.mul_mtx(a_m,a_tmp);
0068     m_touched = true;
0069   }
0070 
0071   void mul_translate(float a_x,float a_y,float a_z) {
0072     m_value.mul_translate(a_x,a_y,a_z);
0073     m_touched = true;
0074   }
0075   void mul_translate(const vec3f& a_v) {
0076     m_value.mul_translate(a_v.x(),a_v.y(),a_v.z());
0077     m_touched = true;
0078   }
0079   void mul_scale(float a_x,float a_y,float a_z) {
0080     m_value.mul_scale(a_x,a_y,a_z);
0081     m_touched = true;
0082   }
0083   void mul_scale(float a_s) {
0084     m_value.mul_scale(a_s);
0085     m_touched = true;
0086   }
0087 
0088   void mul_rotate(float a_x,float a_y,float a_z,float a_angle) {
0089     m_value.mul_rotate(a_x,a_y,a_z,a_angle);
0090     m_touched = true;
0091   }
0092 
0093   void mul_rotate(const vec3f& a_axis,float a_angle) {
0094     m_value.mul_rotate(a_axis.x(),a_axis.y(),a_axis.z(),a_angle);
0095     m_touched = true;
0096   }
0097 
0098   void left_mul_rotate(float a_x,float a_y,float a_z,float a_angle) {
0099     m_value.left_mul_rotate(a_x,a_y,a_z,a_angle);
0100     m_touched = true;
0101   }
0102 
0103   void left_mul_scale(float a_x,float a_y,float a_z) {
0104     m_value.left_mul_scale(a_x,a_y,a_z);
0105     m_touched = true;
0106   }
0107 
0108   void left_mul_translate(float a_x,float a_y,float a_z) {
0109     m_value.left_mul_translate(a_x,a_y,a_z);
0110     m_touched = true;
0111   }
0112 
0113   void left_mul_translate(const vec3f& a_v) {
0114     m_value.left_mul_translate(a_v.x(),a_v.y(),a_v.z());
0115     m_touched = true;
0116   }
0117 
0118   bool set_rotate(const vec3f& a_from,const vec3f& a_to,float []) {
0119     rotf qr;
0120     if(!qr.set_value(a_from,a_to)) return false;
0121     qr.value(m_value);
0122     m_touched = true;
0123     return true;
0124   }
0125 
0126   bool mul_rotate(const vec3f& a_from,const vec3f& a_to,float a_tmp[]) {
0127     rotf qr;
0128     if(!qr.set_value(a_from,a_to)) return false;
0129     mat4f rot;
0130     qr.value(rot);
0131     m_value.mul_mtx(rot,a_tmp);
0132     m_touched = true;
0133     return true;
0134   }
0135 };
0136 
0137 }}
0138 
0139 #endif