Files
geant4/source/externals/g4tools/include/tools/lina/mat3d
T
2021-06-25 16:12:29 +02:00

67 lines
1.8 KiB
Plaintext

// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.
#ifndef tools_mat3d
#define tools_mat3d
#include "mat3"
#include <cmath>
namespace tools {
class mat3d : public mat3<double> {
typedef mat3<double> parent;
public:
mat3d(){}
virtual ~mat3d() {}
public:
mat3d(const mat3d& a_from):parent(a_from){}
mat3d& operator=(const mat3d& a_from){
parent::operator=(a_from);
return *this;
}
public:
mat3d(double a_00,double a_01,double a_02, //first row
double a_10,double a_11,double a_12, //second row
double a_20,double a_21,double a_22) //third row
:parent(a_00,a_01,a_02,
a_10,a_11,a_12,
a_20,a_21,a_22)
{}
mat3d(const parent& a_from):parent(a_from){}
mat3d& operator=(const parent& a_from){
parent::operator=(a_from);
return *this;
}
public:
mat3d(const mat3<float>& a_from):parent(){
for(unsigned int index=0;index<9;index++) {
m_vec[index] = a_from.data()[index];
}
}
mat3d& operator=(const mat3<float>& a_from){
for(unsigned int index=0;index<9;index++) {
m_vec[index] = a_from.data()[index];
}
return *this;
}
public:
void set_rotate(const double& a_x,const double& a_y,const double& a_z,const double& a_angle) {
parent::set_rotate(a_x,a_y,a_z,a_angle,::sin,::cos);
}
void mul_rotate(const double& a_x,const double& a_y,const double& a_z,const double& a_angle) {
parent::mul_rotate(a_x,a_y,a_z,a_angle,::sin,::cos);
}
void left_mul_rotate(const double& a_x,const double& a_y,const double& a_z,const double& a_angle) {
parent::left_mul_rotate(a_x,a_y,a_z,a_angle,::sin,::cos);
}
bool get_rotate(double& a_x,double& a_y,double& a_z,double& a_angle) {
return parent::get_rotate(a_x,a_y,a_z,a_angle,::acos,::sin,::sqrt); //warning : acos and not cos.
}
public: //operators
};
}
#endif