g4tools
5.4.0
Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Variables
Typedefs
a
b
c
d
e
f
h
i
k
l
m
o
p
r
s
u
w
z
Enumerations
Enumerator
_
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
l
m
o
p
r
s
t
v
w
x
z
Functions
_
d
g
i
m
p
s
t
v
Typedefs
_
a
c
d
e
g
m
p
s
t
Enumerations
Enumerator
Macros
_
a
b
c
d
e
f
g
i
l
m
o
p
r
s
t
v
w
x
z
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
g4tools
tools
lina
vec4d
Go to the documentation of this file.
1
// Copyright (C) 2010, Guy Barrand. All rights reserved.
2
// See the file tools.license for terms.
3
4
#ifndef tools_vec4d
5
#define tools_vec4d
6
7
#include "
vec4
"
8
#include <cmath>
9
10
namespace
tools
{
11
12
class
vec4d
:
public
vec4
<double> {
13
typedef
vec4<double>
parent
;
14
public
:
15
vec4d
():
parent
() {}
16
vec4d
(
const
double
a_vec[4]):
parent
(a_vec) {}
17
#ifdef TOOLS_MEM
18
vec4d
(
const
double
& a0,
const
double
& a1,
const
double
& a2,
const
double
& a3,
bool
a_inc =
true
):parent(a0,a1,a2,a3,a_inc){}
19
#else
20
vec4d
(
const
double
& a0,
const
double
& a1,
const
double
& a2,
const
double
& a3):
parent
(a0,a1,a2,a3){}
21
#endif
22
virtual
~vec4d
() {}
23
public
:
24
vec4d
(
const
vec4d
& a_from):
parent
(a_from){}
25
vec4d
&
operator=
(
const
vec4d
& a_from){
parent::operator=
(a_from);
return
*
this
;}
26
public
:
//operators
27
vec4d
operator*
(
double
a_v)
const
{
28
return
vec4d
(
m_data
[0]*a_v,
29
m_data
[1]*a_v,
30
m_data
[2]*a_v,
31
m_data
[3]*a_v);
32
}
33
vec4d
operator+
(
const
vec4d
& a_v)
const
{
34
return
vec4d
(
m_data
[0]+a_v.
m_data
[0],
35
m_data
[1]+a_v.
m_data
[1],
36
m_data
[2]+a_v.
m_data
[2],
37
m_data
[3]+a_v.
m_data
[3]);
38
}
39
vec4d
operator-
(
const
vec4d
& a_v)
const
{
40
return
vec4d
(
m_data
[0]-a_v.
m_data
[0],
41
m_data
[1]-a_v.
m_data
[1],
42
m_data
[2]-a_v.
m_data
[2],
43
m_data
[3]-a_v.
m_data
[3]);
44
}
45
vec4d
&
operator+=
(
const
vec4d
& a_v) {
46
m_data
[0] += a_v.
m_data
[0];
47
m_data
[1] += a_v.
m_data
[1];
48
m_data
[2] += a_v.
m_data
[2];
49
m_data
[3] += a_v.
m_data
[3];
50
return
*
this
;
51
}
52
vec4d
&
operator*=
(
double
a_v) {
53
m_data
[0] *= a_v;
54
m_data
[1] *= a_v;
55
m_data
[2] *= a_v;
56
m_data
[3] *= a_v;
57
return
*
this
;
58
}
59
vec4d
operator-
()
const
{
60
return
vec4d
(-
m_data
[0],-
m_data
[1],-
m_data
[2],-
m_data
[3]);
61
}
62
public
:
63
double
length
()
const
{
return
parent::length
(::sqrt);}
64
double
normalize
() {
return
parent::normalize
(::sqrt);}
65
};
66
67
}
68
69
/*
70
#include <vector>
71
72
namespace tools {
73
74
#ifndef SWIG
75
//for sf, mf :
76
inline bool set_from_vec(vec4d& a_v,const std::vector<double>& a_sv) {
77
if(a_sv.size()!=4) return false;
78
a_v[0] = a_sv[0];
79
a_v[1] = a_sv[1];
80
a_v[2] = a_sv[2];
81
a_v[3] = a_sv[3];
82
return true;
83
}
84
#endif
85
86
}
87
*/
88
89
#endif
tools::vec4d::vec4d
vec4d(const vec4d &a_from)
Definition:
vec4d:24
tools::vec4d::length
double length() const
Definition:
vec4d:63
tools::vec4d::operator-
vec4d operator-() const
Definition:
vec4d:59
tools::vec4d::vec4d
vec4d(const double &a0, const double &a1, const double &a2, const double &a3)
Definition:
vec4d:20
tools::vec4d::operator+
vec4d operator+(const vec4d &a_v) const
Definition:
vec4d:33
tools::vec4< double >::m_data
double m_data[4]
Definition:
vec4:262
tools::vec4d::operator*
vec4d operator*(double a_v) const
Definition:
vec4d:27
tools::vec4< double >::operator=
vec4 & operator=(const vec4 &a_from)
Definition:
vec4:77
tools::vec4d::vec4d
vec4d(const double a_vec[4])
Definition:
vec4d:16
tools::vec4d::operator+=
vec4d & operator+=(const vec4d &a_v)
Definition:
vec4d:45
tools::vec4d::vec4d
vec4d()
Definition:
vec4d:15
tools::vec4< double >::length
double length(double(*a_sqrt)(double)) const
Definition:
vec4:125
tools::vec4d::normalize
double normalize()
Definition:
vec4d:64
tools::vec4d::operator*=
vec4d & operator*=(double a_v)
Definition:
vec4d:52
tools::vec4d
Definition:
vec4d:12
tools::vec4d::operator=
vec4d & operator=(const vec4d &a_from)
Definition:
vec4d:25
tools
inlined C code : ///////////////////////////////////
Definition:
aida_ntuple:26
tools::vec4< double >::normalize
double normalize(double(*a_sqrt)(double))
Definition:
vec4:129
tools::vec4d::~vec4d
virtual ~vec4d()
Definition:
vec4d:22
tools::vec4d::operator-
vec4d operator-(const vec4d &a_v) const
Definition:
vec4d:39
vec4
tools::vec4
Definition:
vec4:16
Generated by
1.8.20