Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
Normal3D.h
Go to the documentation of this file.
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_NORMAL3D_H
14#define HEP_NORMAL3D_H
15
16#include <iosfwd>
19
20namespace HepGeom {
21
22 class Transform3D;
23
24 /**
25 * Geometrical 3D Normal.
26 * This is just a declaration of the class needed to define
27 * specializations Normal3D<float> and Normal3D<double>.
28 *
29 * @ingroup geometry
30 * @author Evgeni Chernyaev <[email protected]>
31 */
32 template<class T>
33 class Normal3D : public BasicVector3D<T> {};
34
35 /**
36 * Geometrical 3D Normal with components of float type.
37 *
38 * @author Evgeni Chernyaev <[email protected]>
39 * @ingroup geometry
40 */
41 template<>
42 class Normal3D<float> : public BasicVector3D<float> {
43 public:
44 /**
45 * Default constructor. */
46 Normal3D() = default;
47
48 /**
49 * Constructor from three numbers. */
50 Normal3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
51
52 /**
53 * Constructor from array of floats. */
54 explicit Normal3D(const float * a)
55 : BasicVector3D<float>(a[0],a[1],a[2]) {}
56
57 /**
58 * Copy constructor. */
59 Normal3D(const Normal3D<float> &) = default;
60
61 /**
62 * Move constructor. */
64
65 /**
66 * Constructor from BasicVector3D<float>. */
68
69 /**
70 * Destructor. */
71 ~Normal3D() = default;
72
73 /**
74 * Assignment. */
76
77 /**
78 * Assignment from BasicVector3D<float>. */
81 return *this;
82 }
83
84 /**
85 * Move assignment. */
87
88 /**
89 * Transformation by Transform3D. */
90 Normal3D<float> & transform(const Transform3D & m);
91 };
92
93 /**
94 * Transformation of Normal<float> by Transform3D.
95 * @relates Normal3D
96 */
98 operator*(const Transform3D & m, const Normal3D<float> & n);
99
100 /**
101 * Geometrical 3D Normal with components of double type.
102 *
103 * @author Evgeni Chernyaev <[email protected]>
104 * @ingroup geometry
105 */
106 template<>
107 class Normal3D<double> : public BasicVector3D<double> {
108 public:
109 /**
110 * Default constructor. */
111 Normal3D() = default;
112
113 /**
114 * Constructor from three numbers. */
115 Normal3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
116
117 /**
118 * Constructor from array of floats. */
119 explicit Normal3D(const float * a)
120 : BasicVector3D<double>(a[0],a[1],a[2]) {}
121
122 /**
123 * Constructor from array of doubles. */
124 explicit Normal3D(const double * a)
125 : BasicVector3D<double>(a[0],a[1],a[2]) {}
126
127 /**
128 * Copy constructor. */
129 Normal3D(const Normal3D<double> &) = default;
130
131 /**
132 * Move constructor. */
134
135 /**
136 * Constructor from BasicVector3D<float>. */
137 Normal3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {}
138
139 /**
140 * Constructor from BasicVector3D<double>. */
142
143 /**
144 * Destructor. */
145 ~Normal3D() = default;
146
147 /**
148 * Constructor from CLHEP::Hep3Vector.
149 * This constructor is needed only for backward compatibility and
150 * in principle should be absent.
151 */
153 : BasicVector3D<double>(v.x(),v.y(),v.z()) {}
154
155 /**
156 * Conversion (cast) to CLHEP::Hep3Vector.
157 * This operator is needed only for backward compatibility and
158 * in principle should not exit.
159 */
160 operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
161
162 /**
163 * Assignment. */
165
166 /**
167 * Assignment from BasicVector3D<float>. */
170 return *this;
171 }
172
173 /**
174 * Assignment from BasicVector3D<double>. */
177 return *this;
178 }
179
180 /**
181 * Move assignment. */
183
184 /**
185 * Transformation by Transform3D. */
186 Normal3D<double> & transform(const Transform3D & m);
187 };
188
189 /**
190 * Transformation of Normal<double> by Transform3D.
191 * @relates Normal3D
192 */
194 operator*(const Transform3D & m, const Normal3D<double> & n);
195
196} /* namespace HepGeom */
197
198#endif /* HEP_NORMAL3D_H */
BasicVector3D< T > & operator=(const BasicVector3D< T > &)=default
Normal3D(double x1, double y1, double z1)
Definition: Normal3D.h:115
Normal3D< double > & operator=(const Normal3D< double > &)=default
Normal3D(const BasicVector3D< float > &v)
Definition: Normal3D.h:137
Normal3D< double > & operator=(Normal3D< double > &&)=default
Normal3D(Normal3D< double > &&)=default
Normal3D< double > & operator=(const BasicVector3D< double > &v)
Definition: Normal3D.h:175
Normal3D(const double *a)
Definition: Normal3D.h:124
Normal3D(const BasicVector3D< double > &v)
Definition: Normal3D.h:141
Normal3D< double > & operator=(const BasicVector3D< float > &v)
Definition: Normal3D.h:168
Normal3D(const Normal3D< double > &)=default
Normal3D(const CLHEP::Hep3Vector &v)
Definition: Normal3D.h:152
Normal3D(const float *a)
Definition: Normal3D.h:119
Normal3D(const Normal3D< float > &)=default
Normal3D< float > & operator=(const Normal3D< float > &)=default
Normal3D(const BasicVector3D< float > &v)
Definition: Normal3D.h:67
Normal3D< float > & operator=(Normal3D< float > &&)=default
Normal3D(const float *a)
Definition: Normal3D.h:54
Normal3D< float > & operator=(const BasicVector3D< float > &v)
Definition: Normal3D.h:79
Normal3D(Normal3D< float > &&)=default
Normal3D(float x1, float y1, float z1)
Definition: Normal3D.h:50
Normal3D< float > operator*(const Transform3D &m, const Normal3D< float > &v)
Definition: Normal3D.cc:23