g4tools  5.4.0
Public Member Functions | List of all members
tools::vec3d Class Reference
Inheritance diagram for tools::vec3d:
Inheritance graph
[legend]
Collaboration diagram for tools::vec3d:
Collaboration graph
[legend]

Public Member Functions

 TOOLS_SCLASS (tools::vec3d) public
 
 vec3d (const double a_vec[3])
 
 vec3d (double a0, double a1, double a2)
 
virtual ~vec3d ()
 
 vec3d (const vec3d &a_from)
 
vec3doperator= (const vec3d &a_from)
 
 vec3d (const parent &a_from)
 
vec3d operator* (double a_v) const
 
vec3d operator+ (const vec3d &a_v) const
 
vec3d operator- (const vec3d &a_v) const
 
vec3doperator+= (const vec3d &a_v)
 
vec3doperator-= (const vec3d &a_v)
 
vec3doperator*= (double a_v)
 
vec3d operator- () const
 
double length () const
 
double normalize ()
 
double mag2 () const
 
void set (double a_0, double a_1, double a_2)
 
void rotateUz (const vec3d &a_new_uz_vector)
 
- Public Member Functions inherited from tools::vec3< double >
unsigned int dimension () const
 
 vec3 ()
 
 vec3 (const double a_vec[3])
 
 vec3 (const double &a0, const double &a1, const double &a2)
 
 vec3 (const vec3 &a_from)
 
virtual ~vec3 ()
 
vec3operator= (const vec3 &a_from)
 
const double & v0 () const
 
void v0 (const double &a_value)
 
const double & v1 () const
 
void v1 (const double &a_value)
 
const double & v2 () const
 
void v2 (const double &a_value)
 
const double & x () const
 
double & x ()
 
const double & y () const
 
double & y ()
 
const double & z () const
 
double & z ()
 
void set_value (const double &a0, const double &a1, const double &a2)
 
void set_value (const double aV[3])
 
void value (double &a0, double &a1, double &a2) const
 
double length (double(*a_sqrt)(double)) const
 
double normalize (double(*a_sqrt)(double))
 
double dot (const vec3 &aV) const
 
void cross (const vec3< double > &aV, vec3< double > &a_value) const
 
bool equal (const vec3 &aV) const
 
bool equal_prec (const vec3 &a_v, PREC a_prec, PREC(*a_fabs)(const double &)) const
 
vec3< double > _cross (const vec3< double > &aV) const
 
bool divide (const double &a_T)
 
void multiply (const double &a_T)
 
void add (const vec3 &a_v)
 
void add (const double &a0, const double &a1, const double &a2)
 
void subtract (const vec3 &a_v)
 
void subtract (const double &a0, const double &a1, const double &a2)
 
bool cos_angle (const vec3 &a_v, double &a_cos, double(*a_sqrt)(double)) const
 
bool theta_phi (double &a_theta, double &a_phi, double(*a_sqrt)(double), double(*a_atan2)(double, double)) const
 
double & operator[] (size_t a_index)
 
const double & operator[] (size_t a_index) const
 
vec3operator*= (const double &a_v)
 
vec3 operator+ (const vec3 &a_v) const
 
vec3 operator- (const vec3 &a_v) const
 
vec3 operator* (const double &a_v) const
 
vec3 operator/ (const double &a_v) const
 
bool operator== (const vec3 &a_v) const
 
bool operator!= (const vec3 &a_v) const
 
size_type size () const
 
const double * data () const
 
size_type data_size () const
 
const double * getValue () const
 
void getValue (double &a0, double &a1, double &a2) const
 
void setValue (const double &a0, const double &a1, const double &a2)
 
void setValue (const vec3 &a_v)
 
void setValue (const double aV[3])
 
vec3setValue (const vec3 &a_bary, const vec3 &a_v0, const vec3 &a_v1, const vec3 &a_v2)
 

Additional Inherited Members

- Public Types inherited from tools::vec3< double >
typedef double elem_t
 
typedef unsigned int size_type
 
- Static Public Member Functions inherited from tools::vec3< double >
static const vec3< double > & s_x ()
 
static const vec3< double > & s_y ()
 
static const vec3< double > & s_z ()
 
- Protected Attributes inherited from tools::vec3< double >
double m_data [3]
 

Detailed Description

Definition at line 13 of file vec3d.

Constructor & Destructor Documentation

◆ vec3d() [1/4]

tools::vec3d::vec3d ( const double  a_vec[3])
inline

Definition at line 19 of file vec3d.

19 :parent(a_vec){}

◆ vec3d() [2/4]

tools::vec3d::vec3d ( double  a0,
double  a1,
double  a2 
)
inline

Definition at line 20 of file vec3d.

20 :parent(a0,a1,a2){}

◆ ~vec3d()

virtual tools::vec3d::~vec3d ( )
inlinevirtual

Definition at line 21 of file vec3d.

21 {}

◆ vec3d() [3/4]

tools::vec3d::vec3d ( const vec3d a_from)
inline

Definition at line 23 of file vec3d.

23 :parent(a_from){}

◆ vec3d() [4/4]

tools::vec3d::vec3d ( const parent a_from)
inline

Definition at line 29 of file vec3d.

29 :parent(a_from){}

Member Function Documentation

◆ length()

double tools::vec3d::length ( ) const
inline

Definition at line 69 of file vec3d.

69 {return parent::length(::sqrt);}

◆ mag2()

double tools::vec3d::mag2 ( ) const
inline

Definition at line 72 of file vec3d.

72 {return m_data[0]*m_data[0]+m_data[1]*m_data[1]+m_data[2]*m_data[2];}

◆ normalize()

double tools::vec3d::normalize ( )
inline

Definition at line 70 of file vec3d.

70 {return parent::normalize(::sqrt);}

◆ operator*()

vec3d tools::vec3d::operator* ( double  a_v) const
inline

Definition at line 32 of file vec3d.

32  {
33  return vec3d(m_data[0]*a_v,
34  m_data[1]*a_v,
35  m_data[2]*a_v);
36  }

◆ operator*=()

vec3d& tools::vec3d::operator*= ( double  a_v)
inline

Definition at line 59 of file vec3d.

59  {
60  m_data[0] *= a_v;
61  m_data[1] *= a_v;
62  m_data[2] *= a_v;
63  return *this;
64  }

◆ operator+()

vec3d tools::vec3d::operator+ ( const vec3d a_v) const
inline

Definition at line 37 of file vec3d.

37  {
38  return vec3d(m_data[0]+a_v.m_data[0],
39  m_data[1]+a_v.m_data[1],
40  m_data[2]+a_v.m_data[2]);
41  }

◆ operator+=()

vec3d& tools::vec3d::operator+= ( const vec3d a_v)
inline

Definition at line 47 of file vec3d.

47  {
48  m_data[0] += a_v.m_data[0];
49  m_data[1] += a_v.m_data[1];
50  m_data[2] += a_v.m_data[2];
51  return *this;
52  }

◆ operator-() [1/2]

vec3d tools::vec3d::operator- ( ) const
inline

Definition at line 65 of file vec3d.

65  {
66  return vec3d(-m_data[0],-m_data[1],-m_data[2]);
67  }

◆ operator-() [2/2]

vec3d tools::vec3d::operator- ( const vec3d a_v) const
inline

Definition at line 42 of file vec3d.

42  {
43  return vec3d(m_data[0]-a_v.m_data[0],
44  m_data[1]-a_v.m_data[1],
45  m_data[2]-a_v.m_data[2]);
46  }

◆ operator-=()

vec3d& tools::vec3d::operator-= ( const vec3d a_v)
inline

Definition at line 53 of file vec3d.

53  {
54  m_data[0] -= a_v.m_data[0];
55  m_data[1] -= a_v.m_data[1];
56  m_data[2] -= a_v.m_data[2];
57  return *this;
58  }

◆ operator=()

vec3d& tools::vec3d::operator= ( const vec3d a_from)
inline

Definition at line 24 of file vec3d.

24  {
25  parent::operator=(a_from);
26  return *this;
27  }

◆ rotateUz()

void tools::vec3d::rotateUz ( const vec3d a_new_uz_vector)
inline

Definition at line 78 of file vec3d.

78  { //from CLHEP/ThreeVector.cc.
79  // a_new_uz_vector must be normalized !
80  double& dx = m_data[0];
81  double& dy = m_data[1];
82  double& dz = m_data[2];
83  double u1 = a_new_uz_vector.x();
84  double u2 = a_new_uz_vector.y();
85  double u3 = a_new_uz_vector.z();
86  double up = u1*u1 + u2*u2;
87  if (up>0) {
88  up = std::sqrt(up);
89  double px = dx, py = dy, pz = dz;
90  dx = (u1*u3*px - u2*py)/up + u1*pz;
91  dy = (u2*u3*px + u1*py)/up + u2*pz;
92  dz = -up*px + u3*pz;
93  } else if (u3 < 0.) { // phi=0 teta=pi
94  dx = -dx; dz = -dz;
95  } else {
96  }
97  //return *this;
98  }

◆ set()

void tools::vec3d::set ( double  a_0,
double  a_1,
double  a_2 
)
inline

Definition at line 73 of file vec3d.

73  {
74  m_data[0] = a_0;
75  m_data[1] = a_1;
76  m_data[2] = a_2;
77  }

◆ TOOLS_SCLASS()

tools::vec3d::TOOLS_SCLASS ( tools::vec3d  )
inline

Definition at line 16 of file vec3d.

17  :
18  vec3d():parent(){}

The documentation for this class was generated from the following file:
tools::vec3< double >::normalize
double normalize(double(*a_sqrt)(double))
Definition: vec3:118
tools::vec3< double >::length
double length(double(*a_sqrt)(double)) const
Definition: vec3:114
tools::vec3< double >::operator=
vec3 & operator=(const vec3 &a_from)
Definition: vec3:69
tools::vec3d::vec3d
vec3d(const double a_vec[3])
Definition: vec3d:19
tools::vec3< double >::m_data
double m_data[3]
Definition: vec3:310