CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Normal3D.h
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: Normal3D.h,v 1.3 2003/10/23 21:29:50 garren Exp $
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>
18#include "CLHEP/Geometry/defs.h"
19#include "CLHEP/Vector/ThreeVector.h"
20#include "CLHEP/Geometry/BasicVector3D.h"
21
22namespace HepGeom {
23
24 class Transform3D;
25
26 /**
27 * Geometrical 3D Normal.
28 * This is just a declaration of the class needed to define
29 * specializations Normal3D<float> and Normal3D<double>.
30 *
31 * @ingroup geometry
32 * @author Evgeni Chernyaev <[email protected]>
33 */
34 template<class T>
35 class Normal3D : public BasicVector3D<T> {};
36
37 /**
38 * Geometrical 3D Normal with components of float type.
39 *
40 * @author Evgeni Chernyaev <[email protected]>
41 * @ingroup geometry
42 */
43 template<>
44 class Normal3D<float> : public BasicVector3D<float> {
45 public:
46 /**
47 * Default constructor. */
48 Normal3D() = default;
49
50 /**
51 * Constructor from three numbers. */
52 Normal3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
53
54 /**
55 * Constructor from array of floats. */
56 explicit Normal3D(const float * a)
57 : BasicVector3D<float>(a[0],a[1],a[2]) {}
58
59 /**
60 * Copy constructor. */
61 Normal3D(const Normal3D<float> &) = default;
62
63 /**
64 * Move constructor. */
66
67 /**
68 * Constructor from BasicVector3D<float>. */
70
71 /**
72 * Destructor. */
73 ~Normal3D() = default;
74
75 /**
76 * Assignment. */
78
79 /**
80 * Assignment from BasicVector3D<float>. */
83 return *this;
84 }
85
86 /**
87 * Move assignment. */
89
90 /**
91 * Transformation by Transform3D. */
92 Normal3D<float> & transform(const Transform3D & m);
93 };
94
95 /**
96 * Transformation of Normal<float> by Transform3D.
97 * @relates Normal3D
98 */
100 operator*(const Transform3D & m, const Normal3D<float> & n);
101
102 /**
103 * Geometrical 3D Normal with components of double type.
104 *
105 * @author Evgeni Chernyaev <[email protected]>
106 * @ingroup geometry
107 */
108 template<>
109 class Normal3D<double> : public BasicVector3D<double> {
110 public:
111 /**
112 * Default constructor. */
113 Normal3D() = default;
114
115 /**
116 * Constructor from three numbers. */
117 Normal3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
118
119 /**
120 * Constructor from array of floats. */
121 explicit Normal3D(const float * a)
122 : BasicVector3D<double>(a[0],a[1],a[2]) {}
123
124 /**
125 * Constructor from array of doubles. */
126 explicit Normal3D(const double * a)
127 : BasicVector3D<double>(a[0],a[1],a[2]) {}
128
129 /**
130 * Copy constructor. */
131 Normal3D(const Normal3D<double> &) = default;
132
133 /**
134 * Move constructor. */
136
137 /**
138 * Constructor from BasicVector3D<float>. */
140
141 /**
142 * Constructor from BasicVector3D<double>. */
144
145 /**
146 * Destructor. */
147 ~Normal3D() = default;
148
149 /**
150 * Constructor from CLHEP::Hep3Vector.
151 * This constructor is needed only for backward compatibility and
152 * in principle should be absent.
153 */
155 : BasicVector3D<double>(v.x(),v.y(),v.z()) {}
156
157 /**
158 * Conversion (cast) to CLHEP::Hep3Vector.
159 * This operator is needed only for backward compatibility and
160 * in principle should not exit.
161 */
162 operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
163
164 /**
165 * Assignment. */
167
168 /**
169 * Assignment from BasicVector3D<float>. */
172 return *this;
173 }
174
175 /**
176 * Assignment from BasicVector3D<double>. */
179 return *this;
180 }
181
182 /**
183 * Move assignment. */
185
186 /**
187 * Transformation by Transform3D. */
188 Normal3D<double> & transform(const Transform3D & m);
189 };
190
191 /**
192 * Transformation of Normal<double> by Transform3D.
193 * @relates Normal3D
194 */
196 operator*(const Transform3D & m, const Normal3D<double> & n);
197
198} /* namespace HepGeom */
199
200#ifdef ENABLE_BACKWARDS_COMPATIBILITY
201// backwards compatibility will be enabled ONLY in CLHEP 1.9
202typedef HepGeom::Normal3D<double> HepNormal3D;
203#endif
204
205#endif /* HEP_NORMAL3D_H */
BasicVector3D< T > & operator=(const BasicVector3D< T > &)=default
Normal3D(double x1, double y1, double z1)
Definition: Normal3D.h:117
Normal3D< double > & operator=(const Normal3D< double > &)=default
Normal3D(const BasicVector3D< float > &v)
Definition: Normal3D.h:139
Normal3D< double > & operator=(Normal3D< double > &&)=default
Normal3D(Normal3D< double > &&)=default
Normal3D< double > & operator=(const BasicVector3D< double > &v)
Definition: Normal3D.h:177
Normal3D(const double *a)
Definition: Normal3D.h:126
Normal3D(const BasicVector3D< double > &v)
Definition: Normal3D.h:143
Normal3D< double > & operator=(const BasicVector3D< float > &v)
Definition: Normal3D.h:170
Normal3D(const Normal3D< double > &)=default
Normal3D(const CLHEP::Hep3Vector &v)
Definition: Normal3D.h:154
Normal3D(const float *a)
Definition: Normal3D.h:121
Normal3D(const Normal3D< float > &)=default
Normal3D< float > & operator=(const Normal3D< float > &)=default
Normal3D(const BasicVector3D< float > &v)
Definition: Normal3D.h:69
Normal3D< float > & operator=(Normal3D< float > &&)=default
Normal3D(const float *a)
Definition: Normal3D.h:56
Normal3D< float > & operator=(const BasicVector3D< float > &v)
Definition: Normal3D.h:81
Normal3D(Normal3D< float > &&)=default
Normal3D(float x1, float y1, float z1)
Definition: Normal3D.h:52
#define double(obj)
Definition: excDblThrow.cc:32
Normal3D< float > operator*(const Transform3D &m, const Normal3D< float > &v)
Definition: Normal3D.cc:25