ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Point3D.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Point3D.h
1
// -*- C++ -*-
2
// ---------------------------------------------------------------------------
3
//
4
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
5
//
6
// History:
7
// 09.09.96 E.Chernyaev - initial version
8
// 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple
9
// the functionality from CLHEP::Hep3Vector
10
// 01.04.03 E.Chernyaev - CLHEP-1.9: template version
11
//
12
13
#ifndef HEP_POINT3D_H
14
#define HEP_POINT3D_H
15
16
#include <iosfwd>
17
#include "
CLHEP/Vector/ThreeVector.h
"
18
#include "
CLHEP/Geometry/BasicVector3D.h
"
19
20
namespace
HepGeom {
21
22
class
Transform3D
;
23
32
template
<
class
T>
33
class
Point3D
:
public
BasicVector3D
<T> {};
34
41
template
<>
42
class
Point3D
<float> :
public
BasicVector3D
<float> {
43
public
:
46
Point3D
() =
default
;
47
50
Point3D
(
float
x1
,
float
y1
,
float
z1
) :
BasicVector3D
<float>(x1,y1,z1) {}
51
54
explicit
Point3D
(
const
float
*
a
)
55
:
BasicVector3D
<float>(a[0],a[1],a[2]) {}
56
59
Point3D
(
const
Point3D<float>
&) =
default
;
60
63
Point3D
(
Point3D<float>
&&) =
default
;
64
67
Point3D
(
const
BasicVector3D<float>
&
v
) :
BasicVector3D
<float>(v) {}
68
71
~
Point3D
() =
default
;
72
75
Point3D<float>
&
operator=
(
const
Point3D<float>
&) =
default
;
76
79
Point3D<float>
&
operator=
(
const
BasicVector3D<float>
&
v
) {
80
this->
BasicVector3D<float>::operator=
(v);
81
return
*
this
;
82
}
83
86
Point3D<float>
&
operator=
(
Point3D<float>
&&) =
default
;
87
90
float
distance2
()
const
{
return
mag2
(); }
91
94
float
distance2
(
const
Point3D<float>
&
p
)
const
{
95
float
dx
= p.
x
()-
x
(),
dy
= p.
y
()-
y
(),
dz
= p.
z
()-
z
();
96
return
dx*dx +
dy
*
dy
+
dz
*
dz
;
97
}
98
101
float
distance
()
const
{
return
std::sqrt(distance2()); }
102
105
float
distance
(
const
Point3D<float>
&
p
)
const
{
106
return
std::sqrt(distance2(p));
107
}
108
111
Point3D<float>
&
transform
(
const
Transform3D
&
m
);
112
};
113
118
Point3D<float>
119
operator*
(
const
Transform3D
&
m
,
const
Point3D<float> &
p
);
120
127
template
<>
128
class
Point3D
<double> :
public
BasicVector3D
<double> {
129
public
:
132
Point3D
() =
default
;
133
136
Point3D
(
double
x1
,
double
y1
,
double
z1
) :
BasicVector3D
<double>(x1,y1,z1) {}
137
140
explicit
Point3D
(
const
float
*
a
)
141
:
BasicVector3D
<double>(a[0],a[1],a[2]) {}
142
145
explicit
Point3D
(
const
double
*
a
)
146
:
BasicVector3D
<double>(a[0],a[1],a[2]) {}
147
150
Point3D
(
const
Point3D<double>
&) =
default
;
151
154
Point3D
(
Point3D<double>
&&) =
default
;
155
158
Point3D
(
const
BasicVector3D<float>
&
v
) :
BasicVector3D
<double>(v) {}
159
162
Point3D
(
const
BasicVector3D<double>
&
v
) :
BasicVector3D
<double>(v) {}
163
166
~
Point3D
() =
default
;
167
173
Point3D
(
const
CLHEP::Hep3Vector
&
v
)
174
:
BasicVector3D
<double>(v.
x
(),v.
y
(),v.
z
()) {}
175
181
operator
CLHEP::Hep3Vector
()
const
{
return
CLHEP::Hep3Vector
(
x
(),
y
(),
z
()); }
182
185
Point3D<double>
&
operator=
(
const
Point3D<double>
&) =
default
;
186
189
Point3D<double>
&
operator=
(
const
BasicVector3D<float>
&
v
) {
190
this->
BasicVector3D<double>::operator=
(v);
191
return
*
this
;
192
}
193
196
Point3D<double>
&
operator=
(
const
BasicVector3D<double>
&
v
) {
197
this->
BasicVector3D<double>::operator=
(v);
198
return
*
this
;
199
}
200
203
Point3D<double>
&
operator=
(
Point3D<double>
&&) =
default
;
204
207
double
distance2
()
const
{
return
mag2
(); }
208
211
double
distance2
(
const
Point3D<double>
&
p
)
const
{
212
double
dx
= p.
x
()-
x
(),
dy
= p.
y
()-
y
(),
dz
= p.
z
()-
z
();
213
return
dx*dx +
dy
*
dy
+
dz
*
dz
;
214
}
215
218
double
distance
()
const
{
return
std::sqrt(distance2()); }
219
222
double
distance
(
const
Point3D<double>
&
p
)
const
{
223
return
std::sqrt(distance2(p));
224
}
225
228
Point3D<double>
&
transform
(
const
Transform3D
&
m
);
229
};
230
235
Point3D<double>
236
operator*
(
const
Transform3D
&
m
,
const
Point3D<double> &
p
);
237
238
}
/* namespace HepGeom */
239
240
#endif
/* HEP_POINT3D_H */
geant4
tree
geant4-10.6-release
source
externals
clhep
include
CLHEP
Geometry
Point3D.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:14
using
1.8.2 with
ECCE GitHub integration