Geant4 9.6.0
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// $Id:$
3// ---------------------------------------------------------------------------
4//
5// This file is a part of the CLHEP - a Class Library for High Energy Physics.
6//
7// History:
8// 09.09.96 E.Chernyaev - initial version
9// 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple
10// the functionality from CLHEP::Hep3Vector
11// 01.04.03 E.Chernyaev - CLHEP-1.9: template version
12//
13
14#ifndef HEP_NORMAL3D_H
15#define HEP_NORMAL3D_H
16
17#include <iosfwd>
20
21namespace HepGeom {
22
23 class Transform3D;
24
25 /**
26 * Geometrical 3D Normal.
27 * This is just a declaration of the class needed to define
28 * specializations Normal3D<float> and Normal3D<double>.
29 *
30 * @ingroup geometry
31 * @author Evgeni Chernyaev <[email protected]>
32 */
33 template<class T>
34 class Normal3D : public BasicVector3D<T> {};
35
36 /**
37 * Geometrical 3D Normal with components of float type.
38 *
39 * @author Evgeni Chernyaev <[email protected]>
40 * @ingroup geometry
41 */
42 template<>
43 class Normal3D<float> : public BasicVector3D<float> {
44 public:
45 /**
46 * Default constructor. */
48
49 /**
50 * Constructor from three numbers. */
51 Normal3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
52
53 /**
54 * Constructor from array of floats. */
55 explicit Normal3D(const float * a)
56 : BasicVector3D<float>(a[0],a[1],a[2]) {}
57
58 /**
59 * Copy constructor. */
60 Normal3D(const Normal3D<float> & v) : BasicVector3D<float>(v) {}
61
62 /**
63 * Constructor from BasicVector3D<float>. */
65
66 /**
67 * Destructor. */
69
70 /**
71 * Assignment. */
73 set(v.x(),v.y(),v.z()); return *this;
74 }
75
76 /**
77 * Assignment from BasicVector3D<float>. */
79 set(v.x(),v.y(),v.z()); return *this;
80 }
81
82 /**
83 * Transformation by Transform3D. */
84 Normal3D<float> & transform(const Transform3D & m);
85 };
86
87 /**
88 * Transformation of Normal<float> by Transform3D.
89 * @relates Normal3D
90 */
91 Normal3D<float>
92 operator*(const Transform3D & m, const Normal3D<float> & n);
93
94 /**
95 * Geometrical 3D Normal with components of double type.
96 *
97 * @author Evgeni Chernyaev <[email protected]>
98 * @ingroup geometry
99 */
100 template<>
101 class Normal3D<double> : public BasicVector3D<double> {
102 public:
103 /**
104 * Default constructor. */
106
107 /**
108 * Constructor from three numbers. */
109 Normal3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
110
111 /**
112 * Constructor from array of floats. */
113 explicit Normal3D(const float * a)
114 : BasicVector3D<double>(a[0],a[1],a[2]) {}
115
116 /**
117 * Constructor from array of doubles. */
118 explicit Normal3D(const double * a)
119 : BasicVector3D<double>(a[0],a[1],a[2]) {}
120
121 /**
122 * Copy constructor. */
123 Normal3D(const Normal3D<double> & v) : BasicVector3D<double>(v) {}
124
125 /**
126 * Constructor from BasicVector3D<float>. */
127 Normal3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {}
128
129 /**
130 * Constructor from BasicVector3D<double>. */
132
133 /**
134 * Destructor. */
136
137 /**
138 * Constructor from CLHEP::Hep3Vector.
139 * This constructor is needed only for backward compatibility and
140 * in principle should be absent.
141 */
143 : BasicVector3D<double>(v.x(),v.y(),v.z()) {}
144
145 /**
146 * Conversion (cast) to CLHEP::Hep3Vector.
147 * This operator is needed only for backward compatibility and
148 * in principle should not exit.
149 */
150 operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
151
152 /**
153 * Assignment. */
155 set(v.x(),v.y(),v.z()); return *this;
156 }
157
158 /**
159 * Assignment from BasicVector3D<float>. */
161 set(v.x(),v.y(),v.z()); return *this;
162 }
163
164 /**
165 * Assignment from BasicVector3D<double>. */
167 set(v.x(),v.y(),v.z()); return *this;
168 }
169
170 /**
171 * Transformation by Transform3D. */
172 Normal3D<double> & transform(const Transform3D & m);
173 };
174
175 /**
176 * Transformation of Normal<double> by Transform3D.
177 * @relates Normal3D
178 */
179 Normal3D<double>
180 operator*(const Transform3D & m, const Normal3D<double> & n);
181
182} /* namespace HepGeom */
183
184#endif /* HEP_NORMAL3D_H */
void set(T x1, T y1, T z1)
Normal3D(double x1, double y1, double z1)
Definition: Normal3D.h:109
Normal3D(const BasicVector3D< float > &v)
Definition: Normal3D.h:127
Normal3D(const Normal3D< double > &v)
Definition: Normal3D.h:123
Normal3D< double > & operator=(const BasicVector3D< double > &v)
Definition: Normal3D.h:166
Normal3D(const double *a)
Definition: Normal3D.h:118
Normal3D(const BasicVector3D< double > &v)
Definition: Normal3D.h:131
Normal3D< double > & operator=(const Normal3D< double > &v)
Definition: Normal3D.h:154
Normal3D< double > & operator=(const BasicVector3D< float > &v)
Definition: Normal3D.h:160
Normal3D(const CLHEP::Hep3Vector &v)
Definition: Normal3D.h:142
Normal3D(const float *a)
Definition: Normal3D.h:113
Normal3D(const Normal3D< float > &v)
Definition: Normal3D.h:60
Normal3D< float > & operator=(const Normal3D< float > &v)
Definition: Normal3D.h:72
Normal3D(const BasicVector3D< float > &v)
Definition: Normal3D.h:64
Normal3D(const float *a)
Definition: Normal3D.h:55
Normal3D< float > & operator=(const BasicVector3D< float > &v)
Definition: Normal3D.h:78
Normal3D(float x1, float y1, float z1)
Definition: Normal3D.h:51
Normal3D< float > operator*(const Transform3D &m, const Normal3D< float > &v)
Definition: Normal3D.cc:24