Geant4-11
Public Types | Public Member Functions | Protected Attributes | Related Functions
HepGeom::Normal3D< T > Class Template Reference

#include <Normal3D.h>

Inheritance diagram for HepGeom::Normal3D< T >:
HepGeom::BasicVector3D< T >

Public Types

enum  {
  X = 0 , Y = 1 , Z = 2 , NUM_COORDINATES = 3 ,
  SIZE = NUM_COORDINATES
}
 

Public Member Functions

double angle (const BasicVector3D< double > &v) const
 
float angle (const BasicVector3D< float > &v) const
 
angle (const BasicVector3D< T > &v) const
 
cosTheta () const
 
BasicVector3D< T > cross (const BasicVector3D< T > &v) const
 
dot (const BasicVector3D< T > &v) const
 
eta () const
 
getEta () const
 
getPhi () const
 
getR () const
 
getTheta () const
 
mag () const
 
mag2 () const
 
 operator CLHEP::Hep3Vector () const
 
 operator const T * () const
 
 operator T* ()
 
T & operator() (int i)
 
operator() (int i) const
 
BasicVector3D< T > & operator*= (double a)
 
BasicVector3D< T > & operator+= (const BasicVector3D< T > &v)
 
BasicVector3D< T > & operator-= (const BasicVector3D< T > &v)
 
BasicVector3D< T > & operator/= (double a)
 
T & operator[] (int i)
 
operator[] (int i) const
 
BasicVector3D< T > orthogonal () const
 
perp () const
 
perp (const BasicVector3D< T > &v) const
 
perp2 () const
 
perp2 (const BasicVector3D< T > &v) const
 
phi () const
 
pseudoRapidity () const
 
float pseudoRapidity () const
 
double pseudoRapidity () const
 
r () const
 
rho () const
 
BasicVector3D< double > & rotate (double a, const BasicVector3D< double > &v)
 
BasicVector3D< float > & rotate (float a, const BasicVector3D< float > &v)
 
BasicVector3D< T > & rotate (T a, const BasicVector3D< T > &v)
 
BasicVector3D< double > & rotateX (double a)
 
BasicVector3D< float > & rotateX (float a)
 
BasicVector3D< T > & rotateX (T a)
 
BasicVector3D< double > & rotateY (double a)
 
BasicVector3D< float > & rotateY (float a)
 
BasicVector3D< T > & rotateY (T a)
 
BasicVector3D< double > & rotateZ (double a)
 
BasicVector3D< float > & rotateZ (float a)
 
BasicVector3D< T > & rotateZ (T a)
 
void set (T x1, T y1, T z1)
 
void setEta (double a)
 
void setEta (float a)
 
void setEta (T a)
 
void setMag (T ma)
 
void setPerp (T rh)
 
void setPhi (T ph)
 
void setR (T ma)
 
void setTheta (T th)
 
void setX (T a)
 
void setY (T a)
 
void setZ (T a)
 
theta () const
 
BasicVector3D< T > unit () const
 
x () const
 
y () const
 
z () const
 

Protected Attributes

v_ [3]
 

Related Functions

(Note that these are not member functions.)

bool operator!= (const BasicVector3D< double > &a, const BasicVector3D< double > &b)
 
bool operator!= (const BasicVector3D< float > &a, const BasicVector3D< float > &b)
 
double operator* (const BasicVector3D< double > &a, const BasicVector3D< double > &b)
 
BasicVector3D< double > operator* (const BasicVector3D< double > &v, double a)
 
float operator* (const BasicVector3D< float > &a, const BasicVector3D< float > &b)
 
BasicVector3D< float > operator* (const BasicVector3D< float > &v, double a)
 
Normal3D< double > operator* (const Transform3D &m, const Normal3D< double > &n)
 
Normal3D< float > operator* (const Transform3D &m, const Normal3D< float > &n)
 
BasicVector3D< double > operator* (double a, const BasicVector3D< double > &v)
 
BasicVector3D< float > operator* (double a, const BasicVector3D< float > &v)
 
BasicVector3D< double > operator+ (const BasicVector3D< double > &a, const BasicVector3D< double > &b)
 
BasicVector3D< double > operator+ (const BasicVector3D< double > &v)
 
BasicVector3D< float > operator+ (const BasicVector3D< float > &a, const BasicVector3D< float > &b)
 
BasicVector3D< float > operator+ (const BasicVector3D< float > &v)
 
BasicVector3D< double > operator- (const BasicVector3D< double > &a, const BasicVector3D< double > &b)
 
BasicVector3D< double > operator- (const BasicVector3D< double > &v)
 
BasicVector3D< float > operator- (const BasicVector3D< float > &a, const BasicVector3D< float > &b)
 
BasicVector3D< float > operator- (const BasicVector3D< float > &v)
 
BasicVector3D< double > operator/ (const BasicVector3D< double > &v, double a)
 
BasicVector3D< float > operator/ (const BasicVector3D< float > &v, double a)
 
std::ostream & operator<< (std::ostream &, const BasicVector3D< double > &)
 
std::ostream & operator<< (std::ostream &, const BasicVector3D< float > &)
 
bool operator== (const BasicVector3D< double > &a, const BasicVector3D< double > &b)
 
bool operator== (const BasicVector3D< float > &a, const BasicVector3D< float > &b)
 
std::istream & operator>> (std::istream &, BasicVector3D< double > &)
 
std::istream & operator>> (std::istream &, BasicVector3D< float > &)
 

Detailed Description

template<class T>
class HepGeom::Normal3D< T >

Geometrical 3D Normal. This is just a declaration of the class needed to define specializations Normal3D<float> and Normal3D<double>.

Author
Evgeni Chernyaev Evgue.nosp@m.ni.T.nosp@m.chern.nosp@m.iaev.nosp@m.@cern.nosp@m..ch

Definition at line 33 of file Normal3D.h.

Member Enumeration Documentation

◆ anonymous enum

template<class T >
anonymous enum
inherited

Safe indexing of the coordinates when using with matrices, arrays, etc.

Enumerator

index for x-component

index for y-component

index for z-component

NUM_COORDINATES 

number of components

SIZE 

number of components

Definition at line 41 of file BasicVector3D.h.

Member Function Documentation

◆ angle() [1/3]

double HepGeom::BasicVector3D< double >::angle ( const BasicVector3D< double > &  v) const
inherited

Definition at line 191 of file BasicVector3D.cc.

191 {
192 double cosa = 0;
193 double ptot = mag()*v.mag();
194 if(ptot > 0) {
195 cosa = dot(v)/ptot;
196 if(cosa > 1) cosa = 1;
197 if(cosa < -1) cosa = -1;
198 }
199 return std::acos(cosa);
200 }
T dot(const BasicVector3D< T > &v) const

References HepGeom::BasicVector3D< T >::mag().

◆ angle() [2/3]

float HepGeom::BasicVector3D< float >::angle ( const BasicVector3D< float > &  v) const
inherited

Definition at line 35 of file BasicVector3D.cc.

35 {
36 double cosa = 0;
37 double ptot = mag()*v.mag();
38 if(ptot > 0) {
39 cosa = dot(v)/ptot;
40 if(cosa > 1) cosa = 1;
41 if(cosa < -1) cosa = -1;
42 }
43 return std::acos(cosa);
44 }

References HepGeom::BasicVector3D< T >::mag().

◆ angle() [3/3]

template<class T >
T HepGeom::BasicVector3D< T >::angle ( const BasicVector3D< T > &  v) const
inherited

Returns angle w.r.t. another vector.

◆ cosTheta()

template<class T >
T HepGeom::BasicVector3D< T >::cosTheta ( ) const
inlineinherited

Gets cosine of polar angle.

Definition at line 217 of file BasicVector3D.h.

217{ T ma = mag(); return ma == 0 ? 1 : z()/ma; }

References HepGeom::BasicVector3D< T >::mag(), and HepGeom::BasicVector3D< T >::z().

◆ cross()

template<class T >
BasicVector3D< T > HepGeom::BasicVector3D< T >::cross ( const BasicVector3D< T > &  v) const
inlineinherited

◆ dot()

template<class T >
T HepGeom::BasicVector3D< T >::dot ( const BasicVector3D< T > &  v) const
inlineinherited

◆ eta()

template<class T >
T HepGeom::BasicVector3D< T >::eta ( ) const
inlineinherited

Gets pseudo-rapidity.

Definition at line 260 of file BasicVector3D.h.

260{ return pseudoRapidity(); }

References HepGeom::BasicVector3D< T >::pseudoRapidity().

◆ getEta()

template<class T >
T HepGeom::BasicVector3D< T >::getEta ( ) const
inlineinherited

Gets pseudo-rapidity.

Definition at line 263 of file BasicVector3D.h.

263{ return pseudoRapidity(); }

References HepGeom::BasicVector3D< T >::pseudoRapidity().

◆ getPhi()

template<class T >
T HepGeom::BasicVector3D< T >::getPhi ( ) const
inlineinherited

Gets phi-component in spherical coordinate system

Definition at line 224 of file BasicVector3D.h.

224{ return phi(); }

References HepGeom::BasicVector3D< T >::phi().

◆ getR()

template<class T >
T HepGeom::BasicVector3D< T >::getR ( ) const
inlineinherited

Gets r-component in spherical coordinate system

Definition at line 221 of file BasicVector3D.h.

221{ return r(); }

References HepGeom::BasicVector3D< T >::r().

◆ getTheta()

template<class T >
T HepGeom::BasicVector3D< T >::getTheta ( ) const
inlineinherited

Gets theta-component in spherical coordinate system

Definition at line 227 of file BasicVector3D.h.

227{ return theta(); }

References HepGeom::BasicVector3D< T >::theta().

◆ mag()

template<class T >
T HepGeom::BasicVector3D< T >::mag ( ) const
inlineinherited

◆ mag2()

template<class T >
T HepGeom::BasicVector3D< T >::mag2 ( ) const
inlineinherited

◆ operator CLHEP::Hep3Vector()

template<class T >
HepGeom::BasicVector3D< T >::operator CLHEP::Hep3Vector ( ) const
inlineinherited

Conversion (cast) to CLHEP::Hep3Vector. This operator is needed only for backward compatibility and in principle should not exit.

Definition at line 90 of file BasicVector3D.h.

90{ return CLHEP::Hep3Vector(x(),y(),z()); }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator const T *()

template<class T >
HepGeom::BasicVector3D< T >::operator const T * ( ) const
inlineinherited

Conversion (cast) to ordinary const array.

Definition at line 83 of file BasicVector3D.h.

83{ return v_; }

◆ operator T*()

template<class T >
HepGeom::BasicVector3D< T >::operator T* ( )
inlineinherited

Conversion (cast) to ordinary array.

Definition at line 79 of file BasicVector3D.h.

79{ return v_; }

◆ operator()() [1/2]

template<class T >
T & HepGeom::BasicVector3D< T >::operator() ( int  i)
inlineinherited

Sets components by index.

Definition at line 136 of file BasicVector3D.h.

136{ return v_[i]; }

References HepGeom::BasicVector3D< T >::v_.

◆ operator()() [2/2]

template<class T >
T HepGeom::BasicVector3D< T >::operator() ( int  i) const
inlineinherited

Gets components by index.

Definition at line 129 of file BasicVector3D.h.

129{ return v_[i]; }

References HepGeom::BasicVector3D< T >::v_.

◆ operator*=()

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::operator*= ( double  a)
inlineinherited

Multiplication by scalar.

Definition at line 114 of file BasicVector3D.h.

114 {
115 v_[0] *= a; v_[1] *= a; v_[2] *= a; return *this;
116 }

References HepGeom::BasicVector3D< T >::v_.

◆ operator+=()

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::operator+= ( const BasicVector3D< T > &  v)
inlineinherited

Addition.

Definition at line 104 of file BasicVector3D.h.

104 {
105 v_[0] += v.v_[0]; v_[1] += v.v_[1]; v_[2] += v.v_[2]; return *this;
106 }

References HepGeom::BasicVector3D< T >::v_.

◆ operator-=()

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::operator-= ( const BasicVector3D< T > &  v)
inlineinherited

Subtraction.

Definition at line 109 of file BasicVector3D.h.

109 {
110 v_[0] -= v.v_[0]; v_[1] -= v.v_[1]; v_[2] -= v.v_[2]; return *this;
111 }

References HepGeom::BasicVector3D< T >::v_.

◆ operator/=()

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::operator/= ( double  a)
inlineinherited

Division by scalar.

Definition at line 119 of file BasicVector3D.h.

119 {
120 v_[0] /= a; v_[1] /= a; v_[2] /= a; return *this;
121 }

References HepGeom::BasicVector3D< T >::v_.

◆ operator[]() [1/2]

template<class T >
T & HepGeom::BasicVector3D< T >::operator[] ( int  i)
inlineinherited

Sets components by index.

Definition at line 139 of file BasicVector3D.h.

139{ return v_[i]; }

References HepGeom::BasicVector3D< T >::v_.

◆ operator[]() [2/2]

template<class T >
T HepGeom::BasicVector3D< T >::operator[] ( int  i) const
inlineinherited

Gets components by index.

Definition at line 132 of file BasicVector3D.h.

132{ return v_[i]; }

References HepGeom::BasicVector3D< T >::v_.

◆ orthogonal()

template<class T >
BasicVector3D< T > HepGeom::BasicVector3D< T >::orthogonal ( ) const
inlineinherited

Returns orthogonal vector.

Definition at line 318 of file BasicVector3D.h.

318 {
319 T dx = x() < 0 ? -x() : x();
320 T dy = y() < 0 ? -y() : y();
321 T dz = z() < 0 ? -z() : z();
322 if (dx < dy) {
323 return dx < dz ?
324 BasicVector3D<T>(0,z(),-y()) : BasicVector3D<T>(y(),-x(),0);
325 }else{
326 return dy < dz ?
327 BasicVector3D<T>(-z(),0,x()) : BasicVector3D<T>(y(),-x(),0);
328 }
329 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ perp() [1/2]

template<class T >
T HepGeom::BasicVector3D< T >::perp ( ) const
inlineinherited

◆ perp() [2/2]

template<class T >
T HepGeom::BasicVector3D< T >::perp ( const BasicVector3D< T > &  v) const
inlineinherited

Returns transverse component w.r.t. given axis.

Definition at line 296 of file BasicVector3D.h.

296 {
297 return std::sqrt(perp2(v));
298 }

References HepGeom::BasicVector3D< T >::perp2().

◆ perp2() [1/2]

template<class T >
T HepGeom::BasicVector3D< T >::perp2 ( ) const
inlineinherited

Gets transverse component squared.

Definition at line 175 of file BasicVector3D.h.

175{ return x()*x()+y()*y(); }

References HepGeom::BasicVector3D< T >::x(), and HepGeom::BasicVector3D< T >::y().

Referenced by HepGeom::BasicVector3D< T >::perp().

◆ perp2() [2/2]

template<class T >
T HepGeom::BasicVector3D< T >::perp2 ( const BasicVector3D< T > &  v) const
inlineinherited

Returns transverse component w.r.t. given axis squared.

Definition at line 289 of file BasicVector3D.h.

289 {
290 T tot = v.mag2(), s = dot(v);
291 return tot > 0 ? mag2()-s*s/tot : mag2();
292 }
static constexpr double s
Definition: G4SIunits.hh:154

References HepGeom::BasicVector3D< T >::dot(), HepGeom::BasicVector3D< T >::mag2(), and s.

◆ phi()

template<class T >
T HepGeom::BasicVector3D< T >::phi ( ) const
inlineinherited

◆ pseudoRapidity() [1/3]

template<class T >
T HepGeom::BasicVector3D< T >::pseudoRapidity ( ) const
inherited

Gets pseudo-rapidity: -ln(tan(theta/2))

Referenced by HepGeom::BasicVector3D< T >::eta(), and HepGeom::BasicVector3D< T >::getEta().

◆ pseudoRapidity() [2/3]

float HepGeom::BasicVector3D< float >::pseudoRapidity ( ) const
inherited

Definition at line 12 of file BasicVector3D.cc.

12 {
13 float ma = mag(), dz = z();
14 if (ma == 0) return 0;
15 if (ma == dz) return FLT_MAX;
16 if (ma == -dz) return -FLT_MAX;
17 return 0.5*std::log((ma+dz)/(ma-dz));
18 }
#define FLT_MAX
Definition: templates.hh:78

References FLT_MAX.

◆ pseudoRapidity() [3/3]

double HepGeom::BasicVector3D< double >::pseudoRapidity ( ) const
inherited

Definition at line 168 of file BasicVector3D.cc.

168 {
169 double ma = mag(), dz = z();
170 if (ma == 0) return 0;
171 if (ma == dz) return DBL_MAX;
172 if (ma == -dz) return -DBL_MAX;
173 return 0.5*std::log((ma+dz)/(ma-dz));
174 }
#define DBL_MAX
Definition: templates.hh:62

References DBL_MAX.

◆ r()

template<class T >
T HepGeom::BasicVector3D< T >::r ( ) const
inlineinherited

Gets r-component in spherical coordinate system

Definition at line 204 of file BasicVector3D.h.

204{ return mag(); }

References HepGeom::BasicVector3D< T >::mag().

Referenced by HepGeom::BasicVector3D< T >::getR().

◆ rho()

template<class T >
T HepGeom::BasicVector3D< T >::rho ( ) const
inlineinherited

Gets rho-component in cylindrical coordinate system

Definition at line 181 of file BasicVector3D.h.

181{ return perp(); }

References HepGeom::BasicVector3D< T >::perp().

◆ rotate() [1/3]

BasicVector3D< double > & HepGeom::BasicVector3D< double >::rotate ( double  a,
const BasicVector3D< double > &  v 
)
inherited

Definition at line 232 of file BasicVector3D.cc.

232 {
233 if (a == 0) return *this;
234 double cx = v.x(), cy = v.y(), cz = v.z();
235 double ll = std::sqrt(cx*cx + cy*cy + cz*cz);
236 if (ll == 0) {
237 std::cerr << "BasicVector<double>::rotate() : zero axis" << std::endl;
238 return *this;
239 }
240 double cosa = std::cos(a), sina = std::sin(a);
241 cx /= ll; cy /= ll; cz /= ll;
242
243 double xx = cosa + (1-cosa)*cx*cx;
244 double xy = (1-cosa)*cx*cy - sina*cz;
245 double xz = (1-cosa)*cx*cz + sina*cy;
246
247 double yx = (1-cosa)*cy*cx + sina*cz;
248 double yy = cosa + (1-cosa)*cy*cy;
249 double yz = (1-cosa)*cy*cz - sina*cx;
250
251 double zx = (1-cosa)*cz*cx - sina*cy;
252 double zy = (1-cosa)*cz*cy + sina*cx;
253 double zz = cosa + (1-cosa)*cz*cz;
254
255 cx = x(); cy = y(); cz = z();
256 set(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz);
257 return *this;
258 }
void set(T x1, T y1, T z1)

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ rotate() [2/3]

BasicVector3D< float > & HepGeom::BasicVector3D< float >::rotate ( float  a,
const BasicVector3D< float > &  v 
)
inherited

Definition at line 76 of file BasicVector3D.cc.

76 {
77 if (a == 0) return *this;
78 double cx = v.x(), cy = v.y(), cz = v.z();
79 double ll = std::sqrt(cx*cx + cy*cy + cz*cz);
80 if (ll == 0) {
81 std::cerr << "BasicVector<float>::rotate() : zero axis" << std::endl;
82 return *this;
83 }
84 double cosa = std::cos(a), sina = std::sin(a);
85 cx /= ll; cy /= ll; cz /= ll;
86
87 double xx = cosa + (1-cosa)*cx*cx;
88 double xy = (1-cosa)*cx*cy - sina*cz;
89 double xz = (1-cosa)*cx*cz + sina*cy;
90
91 double yx = (1-cosa)*cy*cx + sina*cz;
92 double yy = cosa + (1-cosa)*cy*cy;
93 double yz = (1-cosa)*cy*cz - sina*cx;
94
95 double zx = (1-cosa)*cz*cx - sina*cy;
96 double zy = (1-cosa)*cz*cy + sina*cx;
97 double zz = cosa + (1-cosa)*cz*cz;
98
99 cx = x(); cy = y(); cz = z();
100 set(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz);
101 return *this;
102 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ rotate() [3/3]

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::rotate ( a,
const BasicVector3D< T > &  v 
)
inherited

Rotates around the axis specified by another vector.

Referenced by G4OpenGLSceneHandler::AddPrimitive().

◆ rotateX() [1/3]

BasicVector3D< double > & HepGeom::BasicVector3D< double >::rotateX ( double  a)
inherited

Definition at line 204 of file BasicVector3D.cc.

204 {
205 double sina = std::sin(a), cosa = std::cos(a), dy = y(), dz = z();
206 setY(dy*cosa-dz*sina);
207 setZ(dz*cosa+dy*sina);
208 return *this;
209 }

◆ rotateX() [2/3]

BasicVector3D< float > & HepGeom::BasicVector3D< float >::rotateX ( float  a)
inherited

Definition at line 48 of file BasicVector3D.cc.

48 {
49 double sina = std::sin(a), cosa = std::cos(a), dy = y(), dz = z();
50 setY(dy*cosa-dz*sina);
51 setZ(dz*cosa+dy*sina);
52 return *this;
53 }

◆ rotateX() [3/3]

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::rotateX ( a)
inherited

Rotates around x-axis.

◆ rotateY() [1/3]

BasicVector3D< double > & HepGeom::BasicVector3D< double >::rotateY ( double  a)
inherited

Definition at line 213 of file BasicVector3D.cc.

213 {
214 double sina = std::sin(a), cosa = std::cos(a), dz = z(), dx = x();
215 setZ(dz*cosa-dx*sina);
216 setX(dx*cosa+dz*sina);
217 return *this;
218 }

◆ rotateY() [2/3]

BasicVector3D< float > & HepGeom::BasicVector3D< float >::rotateY ( float  a)
inherited

Definition at line 57 of file BasicVector3D.cc.

57 {
58 double sina = std::sin(a), cosa = std::cos(a), dz = z(), dx = x();
59 setZ(dz*cosa-dx*sina);
60 setX(dx*cosa+dz*sina);
61 return *this;
62 }

◆ rotateY() [3/3]

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::rotateY ( a)
inherited

Rotates around y-axis.

◆ rotateZ() [1/3]

BasicVector3D< double > & HepGeom::BasicVector3D< double >::rotateZ ( double  a)
inherited

Definition at line 222 of file BasicVector3D.cc.

222 {
223 double sina = std::sin(a), cosa = std::cos(a), dx = x(), dy = y();
224 setX(dx*cosa-dy*sina);
225 setY(dy*cosa+dx*sina);
226 return *this;
227 }

◆ rotateZ() [2/3]

BasicVector3D< float > & HepGeom::BasicVector3D< float >::rotateZ ( float  a)
inherited

Definition at line 66 of file BasicVector3D.cc.

66 {
67 double sina = std::sin(a), cosa = std::cos(a), dx = x(), dy = y();
68 setX(dx*cosa-dy*sina);
69 setY(dy*cosa+dx*sina);
70 return *this;
71 }

◆ rotateZ() [3/3]

template<class T >
BasicVector3D< T > & HepGeom::BasicVector3D< T >::rotateZ ( a)
inherited

Rotates around z-axis.

Referenced by G4VisCommandSceneAddArrow2D::Arrow2D::Arrow2D().

◆ set()

template<class T >
void HepGeom::BasicVector3D< T >::set ( x1,
y1,
z1 
)
inlineinherited

◆ setEta() [1/3]

void HepGeom::BasicVector3D< double >::setEta ( double  a)
inherited

Definition at line 178 of file BasicVector3D.cc.

178 {
179 double ma = mag();
180 if (ma == 0) return;
181 double tanHalfTheta = std::exp(-a);
182 double tanHalfTheta2 = tanHalfTheta * tanHalfTheta;
183 double cosTheta1 = (1 - tanHalfTheta2) / (1 + tanHalfTheta2);
184 double rh = ma * std::sqrt(1 - cosTheta1*cosTheta1);
185 double ph = phi();
186 set(rh*std::cos(ph), rh*std::sin(ph), ma*cosTheta1);
187 }

◆ setEta() [2/3]

void HepGeom::BasicVector3D< float >::setEta ( float  a)
inherited

Definition at line 22 of file BasicVector3D.cc.

22 {
23 double ma = mag();
24 if (ma == 0) return;
25 double tanHalfTheta = std::exp(-a);
26 double tanHalfTheta2 = tanHalfTheta * tanHalfTheta;
27 double cosTheta1 = (1 - tanHalfTheta2) / (1 + tanHalfTheta2);
28 double rh = ma * std::sqrt(1 - cosTheta1*cosTheta1);
29 double ph = phi();
30 set(rh*std::cos(ph), rh*std::sin(ph), ma*cosTheta1);
31 }

◆ setEta() [3/3]

template<class T >
void HepGeom::BasicVector3D< T >::setEta ( a)
inherited

Sets pseudo-rapidity, keeping magnitude and phi fixed.

◆ setMag()

template<class T >
void HepGeom::BasicVector3D< T >::setMag ( ma)
inlineinherited

Sets magnitude.

Definition at line 231 of file BasicVector3D.h.

231 {
232 T factor = mag();
233 if (factor > 0) {
234 factor = ma/factor; v_[0] *= factor; v_[1] *= factor; v_[2] *= factor;
235 }
236 }

References HepGeom::BasicVector3D< T >::mag(), and HepGeom::BasicVector3D< T >::v_.

Referenced by HepGeom::BasicVector3D< T >::setR().

◆ setPerp()

template<class T >
void HepGeom::BasicVector3D< T >::setPerp ( rh)
inlineinherited

Sets transverse component keeping phi and z constant.

Definition at line 185 of file BasicVector3D.h.

185 {
186 T factor = perp();
187 if (factor > 0) {
188 factor = rh/factor; v_[0] *= factor; v_[1] *= factor;
189 }
190 }

References HepGeom::BasicVector3D< T >::perp(), and HepGeom::BasicVector3D< T >::v_.

◆ setPhi()

template<class T >
void HepGeom::BasicVector3D< T >::setPhi ( ph)
inlineinherited

Sets phi-component in spherical coordinate system.

Definition at line 242 of file BasicVector3D.h.

242{ T xy = perp(); setX(xy*std::cos(ph)); setY(xy*std::sin(ph)); }

References HepGeom::BasicVector3D< T >::perp(), HepGeom::BasicVector3D< T >::setX(), and HepGeom::BasicVector3D< T >::setY().

◆ setR()

template<class T >
void HepGeom::BasicVector3D< T >::setR ( ma)
inlineinherited

Sets r-component in spherical coordinate system.

Definition at line 239 of file BasicVector3D.h.

239{ setMag(ma); }

References HepGeom::BasicVector3D< T >::setMag().

◆ setTheta()

template<class T >
void HepGeom::BasicVector3D< T >::setTheta ( th)
inlineinherited

Sets theta-component in spherical coordinate system.

Definition at line 245 of file BasicVector3D.h.

245 {
246 T ma = mag();
247 T ph = phi();
248 set(ma*std::sin(th)*std::cos(ph), ma*std::sin(th)*std::sin(ph), ma*std::cos(th));
249 }

References HepGeom::BasicVector3D< T >::mag(), HepGeom::BasicVector3D< T >::phi(), and HepGeom::BasicVector3D< T >::set().

◆ setX()

template<class T >
void HepGeom::BasicVector3D< T >::setX ( a)
inlineinherited

◆ setY()

template<class T >
void HepGeom::BasicVector3D< T >::setY ( a)
inlineinherited

◆ setZ()

template<class T >
void HepGeom::BasicVector3D< T >::setZ ( a)
inlineinherited

◆ theta()

template<class T >
T HepGeom::BasicVector3D< T >::theta ( ) const
inlineinherited

◆ unit()

template<class T >
BasicVector3D< T > HepGeom::BasicVector3D< T >::unit ( ) const
inlineinherited

◆ x()

template<class T >
T HepGeom::BasicVector3D< T >::x ( ) const
inlineinherited

Gets x-component in cartesian coordinate system.

Definition at line 147 of file BasicVector3D.h.

147{ return v_[0]; }

References HepGeom::BasicVector3D< T >::v_.

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4HepRepFileSceneHandler::AddCompound(), G4HepRepFileSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4OpenInventorSceneHandler::AddTransform(), HepGeom::BasicVector3D< T >::BasicVector3D(), G4BoundingEnvelope::BoundingBoxVsVoxelLimits(), G4ErrorSurfaceTrajState::BuildErrorMatrix(), G4BoundingEnvelope::CalculateExtent(), G4ViewParameters::CameraAndLightingCommands(), G4BoundingEnvelope::ClipEdgesByVoxel(), G4BoundingEnvelope::ClipVoxelByPlanes(), G4VViewer::ComputeFlyThrough(), G4CutTubs::CreatePolyhedron(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CreateSG(), HepGeom::BasicVector3D< T >::cross(), G4VFieldModel::DescribeYourselfTo(), HepGeom::Plane3D< T >::distance(), HepGeom::Point3D< double >::distance2(), HepGeom::Point3D< float >::distance2(), HepGeom::BasicVector3D< T >::dot(), mcscore.MCVertex::dump_vertex(), G4GMocrenFileSceneHandler::ExtractDetector(), G4ErrorFreeTrajState::G4ErrorFreeTrajState(), G4VisExtent::G4VisExtent(), HepPolyhedronEllipsoid::HepPolyhedronEllipsoid(), HepPolyhedronEllipticalCone::HepPolyhedronEllipticalCone(), HepGeom::BasicVector3D< T >::mag2(), G4ViewParameters::MultiplyScaleFactor(), HepGeom::BasicVector3D< T >::operator CLHEP::Hep3Vector(), HepGeom::Normal3D< double >::operator CLHEP::Hep3Vector(), HepGeom::Point3D< double >::operator CLHEP::Hep3Vector(), HepGeom::Vector3D< double >::operator CLHEP::Hep3Vector(), HepGeom::BasicVector3D< T >::operator!=(), std::hash< G4Polyhedron >::operator()(), HepGeom::BasicVector3D< T >::operator*(), HepGeom::Normal3D< T >::operator*(), HepGeom::Point3D< T >::operator*(), HepGeom::Vector3D< T >::operator*(), HepGeom::BasicVector3D< T >::operator+(), HepGeom::BasicVector3D< T >::operator-(), HepGeom::BasicVector3D< T >::operator/(), HepGeom::BasicVector3D< T >::operator<<(), HepGeom::BasicVector3D< T >::operator==(), HepGeom::BasicVector3D< T >::orthogonal(), HepGeom::BasicVector3D< T >::perp2(), HepGeom::BasicVector3D< T >::phi(), HepGeom::Plane3D< T >::point(), mcscore.MCVertex::printout(), G4ErrorFreeTrajState::PropagateError(), HepGeom::BasicVector3D< T >::rotate(), HepGeom::Rotate3D::Rotate3D(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4ErrorFreeTrajParam::SetParameters(), G4OpenGLViewer::SetView(), G4OpenInventorViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::theta(), HepGeom::Normal3D< float >::transform(), HepGeom::Normal3D< double >::transform(), HepGeom::Point3D< float >::transform(), HepGeom::Point3D< double >::transform(), HepGeom::Vector3D< float >::transform(), HepGeom::Vector3D< double >::transform(), HepGeom::Transform3D::Transform3D(), HepGeom::BasicVector3D< T >::unit(), and G4OpenGLQtViewer::updateViewerPropertiesTableWidget().

◆ y()

template<class T >
T HepGeom::BasicVector3D< T >::y ( ) const
inlineinherited

Gets y-component in cartesian coordinate system.

Definition at line 150 of file BasicVector3D.h.

150{ return v_[1]; }

References HepGeom::BasicVector3D< T >::v_.

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4HepRepFileSceneHandler::AddCompound(), G4HepRepFileSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4OpenInventorSceneHandler::AddTransform(), HepGeom::BasicVector3D< T >::BasicVector3D(), G4BoundingEnvelope::BoundingBoxVsVoxelLimits(), G4ErrorSurfaceTrajState::BuildErrorMatrix(), G4BoundingEnvelope::CalculateExtent(), G4ViewParameters::CameraAndLightingCommands(), G4BoundingEnvelope::ClipEdgesByVoxel(), G4BoundingEnvelope::ClipVoxelByPlanes(), G4VViewer::ComputeFlyThrough(), G4CutTubs::CreatePolyhedron(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CreateSG(), HepGeom::BasicVector3D< T >::cross(), G4VFieldModel::DescribeYourselfTo(), HepGeom::Plane3D< T >::distance(), HepGeom::Point3D< double >::distance2(), HepGeom::Point3D< float >::distance2(), HepGeom::BasicVector3D< T >::dot(), mcscore.MCVertex::dump_vertex(), G4GMocrenFileSceneHandler::ExtractDetector(), G4ErrorFreeTrajState::G4ErrorFreeTrajState(), G4VisExtent::G4VisExtent(), HepPolyhedronEllipsoid::HepPolyhedronEllipsoid(), HepPolyhedronEllipticalCone::HepPolyhedronEllipticalCone(), HepGeom::BasicVector3D< T >::mag2(), G4ViewParameters::MultiplyScaleFactor(), HepGeom::BasicVector3D< T >::operator CLHEP::Hep3Vector(), HepGeom::Normal3D< double >::operator CLHEP::Hep3Vector(), HepGeom::Point3D< double >::operator CLHEP::Hep3Vector(), HepGeom::Vector3D< double >::operator CLHEP::Hep3Vector(), HepGeom::BasicVector3D< T >::operator!=(), std::hash< G4Polyhedron >::operator()(), HepGeom::BasicVector3D< T >::operator*(), HepGeom::Normal3D< T >::operator*(), HepGeom::Point3D< T >::operator*(), HepGeom::Vector3D< T >::operator*(), HepGeom::BasicVector3D< T >::operator+(), HepGeom::BasicVector3D< T >::operator-(), HepGeom::BasicVector3D< T >::operator/(), HepGeom::BasicVector3D< T >::operator<<(), HepGeom::BasicVector3D< T >::operator==(), HepGeom::BasicVector3D< T >::orthogonal(), HepGeom::BasicVector3D< T >::perp2(), HepGeom::BasicVector3D< T >::phi(), HepGeom::Plane3D< T >::point(), mcscore.MCVertex::printout(), G4ErrorFreeTrajState::PropagateError(), HepGeom::BasicVector3D< T >::rotate(), HepGeom::Rotate3D::Rotate3D(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4ErrorFreeTrajParam::SetParameters(), G4OpenGLViewer::SetView(), G4OpenInventorViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::theta(), HepGeom::Normal3D< float >::transform(), HepGeom::Normal3D< double >::transform(), HepGeom::Point3D< float >::transform(), HepGeom::Point3D< double >::transform(), HepGeom::Vector3D< float >::transform(), HepGeom::Vector3D< double >::transform(), HepGeom::Transform3D::Transform3D(), HepGeom::BasicVector3D< T >::unit(), and G4OpenGLQtViewer::updateViewerPropertiesTableWidget().

◆ z()

template<class T >
T HepGeom::BasicVector3D< T >::z ( ) const
inlineinherited

Gets z-component in cartesian coordinate system.

Definition at line 153 of file BasicVector3D.h.

153{ return v_[2]; }

References HepGeom::BasicVector3D< T >::v_.

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4HepRepFileSceneHandler::AddCompound(), G4HepRepFileSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4OpenInventorSceneHandler::AddTransform(), HepGeom::BasicVector3D< T >::BasicVector3D(), G4BoundingEnvelope::BoundingBoxVsVoxelLimits(), G4ErrorSurfaceTrajState::BuildErrorMatrix(), G4BoundingEnvelope::CalculateExtent(), G4ViewParameters::CameraAndLightingCommands(), G4BoundingEnvelope::ClipEdgesByVoxel(), G4BoundingEnvelope::ClipVoxelByPlanes(), G4VViewer::ComputeFlyThrough(), HepGeom::BasicVector3D< T >::cosTheta(), G4CutTubs::CreatePolyhedron(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CreateSG(), HepGeom::BasicVector3D< T >::cross(), G4VFieldModel::DescribeYourselfTo(), HepGeom::Plane3D< T >::distance(), HepGeom::Point3D< double >::distance2(), HepGeom::Point3D< float >::distance2(), HepGeom::BasicVector3D< T >::dot(), mcscore.MCVertex::dump_vertex(), G4GMocrenFileSceneHandler::ExtractDetector(), G4ErrorFreeTrajState::G4ErrorFreeTrajState(), G4VisExtent::G4VisExtent(), HepGeom::BasicVector3D< T >::mag2(), G4ViewParameters::MultiplyScaleFactor(), HepGeom::BasicVector3D< T >::operator CLHEP::Hep3Vector(), HepGeom::Normal3D< double >::operator CLHEP::Hep3Vector(), HepGeom::Point3D< double >::operator CLHEP::Hep3Vector(), HepGeom::Vector3D< double >::operator CLHEP::Hep3Vector(), HepGeom::BasicVector3D< T >::operator!=(), std::hash< G4Polyhedron >::operator()(), HepGeom::BasicVector3D< T >::operator*(), HepGeom::Normal3D< T >::operator*(), HepGeom::Point3D< T >::operator*(), HepGeom::Vector3D< T >::operator*(), HepGeom::BasicVector3D< T >::operator+(), HepGeom::BasicVector3D< T >::operator-(), HepGeom::BasicVector3D< T >::operator/(), HepGeom::BasicVector3D< T >::operator<<(), HepGeom::BasicVector3D< T >::operator==(), HepGeom::BasicVector3D< T >::orthogonal(), HepGeom::Plane3D< T >::point(), mcscore.MCVertex::printout(), G4ErrorFreeTrajState::PropagateError(), HepGeom::BasicVector3D< T >::rotate(), HepGeom::Rotate3D::Rotate3D(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4OpenGLViewer::SetView(), G4OpenInventorViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), HepGeom::BasicVector3D< T >::theta(), HepGeom::Normal3D< float >::transform(), HepGeom::Normal3D< double >::transform(), HepGeom::Point3D< float >::transform(), HepGeom::Point3D< double >::transform(), HepGeom::Vector3D< float >::transform(), HepGeom::Vector3D< double >::transform(), HepGeom::Transform3D::Transform3D(), HepGeom::BasicVector3D< T >::unit(), and G4OpenGLQtViewer::updateViewerPropertiesTableWidget().

Friends And Related Function Documentation

◆ operator!=() [1/2]

template<class T >
bool operator!= ( const BasicVector3D< double > &  a,
const BasicVector3D< double > &  b 
)
related

Comparison of two vectors for inequality.

Definition at line 562 of file BasicVector3D.h.

563 {
564 return (a.x()!=b.x() || a.y()!=b.y() || a.z()!=b.z());
565 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator!=() [2/2]

template<class T >
bool operator!= ( const BasicVector3D< float > &  a,
const BasicVector3D< float > &  b 
)
related

Comparison of two vectors for inequality.

Definition at line 453 of file BasicVector3D.h.

453 {
454 return (a.x()!=b.x() || a.y()!=b.y() || a.z()!=b.z());
455 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator*() [1/8]

template<class T >
double operator* ( const BasicVector3D< double > &  a,
const BasicVector3D< double > &  b 
)
related

Scalar product of two vectors.

Definition at line 525 of file BasicVector3D.h.

525 {
526 return a.dot(b);
527 }

References HepGeom::BasicVector3D< T >::dot().

◆ operator*() [2/8]

template<class T >
BasicVector3D< double > operator* ( const BasicVector3D< double > &  v,
double  a 
)
related

Multiplication vector by scalar.

Definition at line 516 of file BasicVector3D.h.

516 {
517 return BasicVector3D<double>(v.x()*a, v.y()*a, v.z()*a);
518 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator*() [3/8]

template<class T >
float operator* ( const BasicVector3D< float > &  a,
const BasicVector3D< float > &  b 
)
related

Scalar product of two vectors.

Definition at line 417 of file BasicVector3D.h.

417 {
418 return a.dot(b);
419 }

References HepGeom::BasicVector3D< T >::dot().

◆ operator*() [4/8]

template<class T >
BasicVector3D< float > operator* ( const BasicVector3D< float > &  v,
double  a 
)
related

Multiplication vector by scalar.

Definition at line 408 of file BasicVector3D.h.

408 {
409 return BasicVector3D<float>(v.x()*static_cast<float>(a), v.y()*static_cast<float>(a), v.z()*static_cast<float>(a));
410 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator*() [5/8]

template<class T >
Normal3D< double > operator* ( const Transform3D m,
const Normal3D< double > &  n 
)
related

Transformation of Normal<double> by Transform3D.

Definition at line 49 of file Normal3D.cc.

49 {
50 double vx = v.x(), vy = v.y(), vz = v.z();
51 double xx = m.xx(), xy = m.xy(), xz = m.xz();
52 double yx = m.yx(), yy = m.yy(), yz = m.yz();
53 double zx = m.zx(), zy = m.zy(), zz = m.zz();
54 return Normal3D<double>
55 ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz,
56 (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz,
57 (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz);
58 }
static constexpr double m
Definition: G4SIunits.hh:109

References m, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator*() [6/8]

template<class T >
Normal3D< float > operator* ( const Transform3D m,
const Normal3D< float > &  n 
)
related

Transformation of Normal<float> by Transform3D.

Definition at line 23 of file Normal3D.cc.

23 {
24 double vx = v.x(), vy = v.y(), vz = v.z();
25 double xx = m.xx(), xy = m.xy(), xz = m.xz();
26 double yx = m.yx(), yy = m.yy(), yz = m.yz();
27 double zx = m.zx(), zy = m.zy(), zz = m.zz();
28 return Normal3D<float>
29 ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz,
30 (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz,
31 (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz);
32 }

References m, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator*() [7/8]

template<class T >
BasicVector3D< double > operator* ( double  a,
const BasicVector3D< double > &  v 
)
related

Multiplication scalar by vector.

Definition at line 534 of file BasicVector3D.h.

534 {
535 return BasicVector3D<double>(a*v.x(), a*v.y(), a*v.z());
536 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator*() [8/8]

template<class T >
BasicVector3D< float > operator* ( double  a,
const BasicVector3D< float > &  v 
)
related

Multiplication scalar by vector.

Definition at line 426 of file BasicVector3D.h.

426 {
427 return BasicVector3D<float>(static_cast<float>(a)*v.x(), static_cast<float>(a)*v.y(), static_cast<float>(a)*v.z());
428 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator+() [1/4]

template<class T >
BasicVector3D< double > operator+ ( const BasicVector3D< double > &  a,
const BasicVector3D< double > &  b 
)
related

Addition of two vectors.

Definition at line 489 of file BasicVector3D.h.

489 {
490 return BasicVector3D<double>(a.x()+b.x(), a.y()+b.y(), a.z()+b.z());
491 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator+() [2/4]

template<class T >
BasicVector3D< double > operator+ ( const BasicVector3D< double > &  v)
related

Unary plus.

Definition at line 482 of file BasicVector3D.h.

482{ return v; }

◆ operator+() [3/4]

template<class T >
BasicVector3D< float > operator+ ( const BasicVector3D< float > &  a,
const BasicVector3D< float > &  b 
)
related

Addition of two vectors.

Definition at line 381 of file BasicVector3D.h.

381 {
382 return BasicVector3D<float>(a.x()+b.x(), a.y()+b.y(), a.z()+b.z());
383 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator+() [4/4]

template<class T >
BasicVector3D< float > operator+ ( const BasicVector3D< float > &  v)
related

Unary plus.

Definition at line 374 of file BasicVector3D.h.

374{ return v; }

◆ operator-() [1/4]

template<class T >
BasicVector3D< double > operator- ( const BasicVector3D< double > &  a,
const BasicVector3D< double > &  b 
)
related

Subtraction of two vectors.

Definition at line 507 of file BasicVector3D.h.

507 {
508 return BasicVector3D<double>(a.x()-b.x(), a.y()-b.y(), a.z()-b.z());
509 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator-() [2/4]

template<class T >
BasicVector3D< double > operator- ( const BasicVector3D< double > &  v)
related

Unary minus.

Definition at line 498 of file BasicVector3D.h.

498 {
499 return BasicVector3D<double>(-v.x(), -v.y(), -v.z());
500 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator-() [3/4]

template<class T >
BasicVector3D< float > operator- ( const BasicVector3D< float > &  a,
const BasicVector3D< float > &  b 
)
related

Subtraction of two vectors.

Definition at line 399 of file BasicVector3D.h.

399 {
400 return BasicVector3D<float>(a.x()-b.x(), a.y()-b.y(), a.z()-b.z());
401 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator-() [4/4]

template<class T >
BasicVector3D< float > operator- ( const BasicVector3D< float > &  v)
related

Unary minus.

Definition at line 390 of file BasicVector3D.h.

390 {
391 return BasicVector3D<float>(-v.x(), -v.y(), -v.z());
392 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator/() [1/2]

template<class T >
BasicVector3D< double > operator/ ( const BasicVector3D< double > &  v,
double  a 
)
related

Division vector by scalar.

Definition at line 543 of file BasicVector3D.h.

543 {
544 return BasicVector3D<double>(v.x()/a, v.y()/a, v.z()/a);
545 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator/() [2/2]

template<class T >
BasicVector3D< float > operator/ ( const BasicVector3D< float > &  v,
double  a 
)
related

Division vector by scalar.

Definition at line 435 of file BasicVector3D.h.

435 {
436 return BasicVector3D<float>(v.x()/static_cast<float>(a), v.y()/static_cast<float>(a), v.z()/static_cast<float>(a));
437 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator<<() [1/2]

template<class T >
std::ostream & operator<< ( std::ostream &  ,
const BasicVector3D< double > &   
)
related

Output to stream.

Definition at line 261 of file BasicVector3D.cc.

263 {
264 return os << "(" << a.x() << "," << a.y() << "," << a.z() << ")";
265 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator<<() [2/2]

template<class T >
std::ostream & operator<< ( std::ostream &  ,
const BasicVector3D< float > &   
)
related

Output to stream.

Definition at line 105 of file BasicVector3D.cc.

107 {
108 return os << "(" << a.x() << "," << a.y() << "," << a.z() << ")";
109 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator==() [1/2]

template<class T >
bool operator== ( const BasicVector3D< double > &  a,
const BasicVector3D< double > &  b 
)
related

Comparison of two vectors for equality.

Definition at line 552 of file BasicVector3D.h.

553 {
554 return (a.x()==b.x() && a.y()==b.y() && a.z()==b.z());
555 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ operator==() [2/2]

template<class T >
bool operator== ( const BasicVector3D< float > &  a,
const BasicVector3D< float > &  b 
)
related

Comparison of two vectors for equality.

Definition at line 444 of file BasicVector3D.h.

444 {
445 return (a.x()==b.x() && a.y()==b.y() && a.z()==b.z());
446 }

References HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4Solver< Function >::operator!=().

◆ operator>>() [1/2]

template<class T >
std::istream & operator>> ( std::istream &  ,
BasicVector3D< double > &   
)
related

Input from stream.

Definition at line 269 of file BasicVector3D.cc.

270 {
271 // Required format is ( a, b, c ) that is, three numbers, preceded by
272 // (, followed by ), and separated by commas. The three numbers are
273 // taken as x, y, z.
274
275 double x, y, z;
276 char c;
277
278 is >> std::ws >> c;
279 // ws is defined to invoke eatwhite(istream & )
280 // see (Stroustrup gray book) page 333 and 345.
281 if (is.fail() || c != '(' ) {
282 std::cerr
283 << "Could not find required opening parenthesis "
284 << "in input of a BasicVector3D<double>"
285 << std::endl;
286 return is;
287 }
288
289 is >> x >> std::ws >> c;
290 if (is.fail() || c != ',' ) {
291 std::cerr
292 << "Could not find x value and required trailing comma "
293 << "in input of a BasicVector3D<double>"
294 << std::endl;
295 return is;
296 }
297
298 is >> y >> std::ws >> c;
299 if (is.fail() || c != ',' ) {
300 std::cerr
301 << "Could not find y value and required trailing comma "
302 << "in input of a BasicVector3D<double>"
303 << std::endl;
304 return is;
305 }
306
307 is >> z >> std::ws >> c;
308 if (is.fail() || c != ')' ) {
309 std::cerr
310 << "Could not find z value and required close parenthesis "
311 << "in input of a BasicVector3D<double>"
312 << std::endl;
313 return is;
314 }
315
316 a.setX(x);
317 a.setY(y);
318 a.setZ(z);
319 return is;
320 }

References HepGeom::BasicVector3D< T >::setX(), HepGeom::BasicVector3D< T >::setY(), and HepGeom::BasicVector3D< T >::setZ().

◆ operator>>() [2/2]

template<class T >
std::istream & operator>> ( std::istream &  ,
BasicVector3D< float > &   
)
related

Input from stream.

Definition at line 113 of file BasicVector3D.cc.

114 {
115 // Required format is ( a, b, c ) that is, three numbers, preceded by
116 // (, followed by ), and separated by commas. The three numbers are
117 // taken as x, y, z.
118
119 float x, y, z;
120 char c;
121
122 is >> std::ws >> c;
123 // ws is defined to invoke eatwhite(istream & )
124 // see (Stroustrup gray book) page 333 and 345.
125 if (is.fail() || c != '(' ) {
126 std::cerr
127 << "Could not find required opening parenthesis "
128 << "in input of a BasicVector3D<float>"
129 << std::endl;
130 return is;
131 }
132
133 is >> x >> std::ws >> c;
134 if (is.fail() || c != ',' ) {
135 std::cerr
136 << "Could not find x value and required trailing comma "
137 << "in input of a BasicVector3D<float>"
138 << std::endl;
139 return is;
140 }
141
142 is >> y >> std::ws >> c;
143 if (is.fail() || c != ',' ) {
144 std::cerr
145 << "Could not find y value and required trailing comma "
146 << "in input of a BasicVector3D<float>"
147 << std::endl;
148 return is;
149 }
150
151 is >> z >> std::ws >> c;
152 if (is.fail() || c != ')' ) {
153 std::cerr
154 << "Could not find z value and required close parenthesis "
155 << "in input of a BasicVector3D<float>"
156 << std::endl;
157 return is;
158 }
159
160 a.setX(x);
161 a.setY(y);
162 a.setZ(z);
163 return is;
164 }

References HepGeom::BasicVector3D< T >::setX(), HepGeom::BasicVector3D< T >::setY(), and HepGeom::BasicVector3D< T >::setZ().

Field Documentation

◆ v_

template<class T >
T HepGeom::BasicVector3D< T >::v_[3]
protectedinherited

The documentation for this class was generated from the following file: