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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/clhep/include/CLHEP/Geometry/Point3D.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Geometry/Point3D.h (Version 7.0.p1)


  1 // -*- C++ -*-                                      1 
  2 // -------------------------------------------    
  3 //                                                
  4 // This file is a part of the CLHEP - a Class     
  5 //                                                
  6 // History:                                       
  7 // 09.09.96 E.Chernyaev - initial version         
  8 // 12.06.01 E.Chernyaev - CLHEP-1.7: introduct    
  9 //                        the functionality fr    
 10 // 01.04.03 E.Chernyaev - CLHEP-1.9: template     
 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                                                   
 24   /**                                             
 25    * Geometrical 3D Point.                        
 26    * This is just a declaration of the class n    
 27    * specializations Point3D<float> and Point3    
 28    *                                              
 29    * @ingroup geometry                            
 30    * @author Evgeni Chernyaev <Evgueni.Tcherni    
 31    */                                             
 32   template<class T>                               
 33   class Point3D : public BasicVector3D<T> {};     
 34                                                   
 35   /**                                             
 36    * Geometrical 3D Point with components of f    
 37    *                                              
 38    * @author Evgeni Chernyaev <Evgueni.Tcherni    
 39    * @ingroup geometry                            
 40    */                                             
 41   template<>                                      
 42   class Point3D<float> : public BasicVector3D<    
 43   public:                                         
 44     /**                                           
 45      * Default constructor. */                    
 46     Point3D() = default;                          
 47                                                   
 48     /**                                           
 49      * Constructor from three numbers. */         
 50     Point3D(float x1, float y1, float z1) : Ba    
 51                                                   
 52     /**                                           
 53      * Constructor from array of floats. */       
 54     explicit Point3D(const float * a)             
 55       : BasicVector3D<float>(a[0],a[1],a[2]) {    
 56                                                   
 57     /**                                           
 58      * Copy constructor. */                       
 59     Point3D(const Point3D<float> &) = default;    
 60                                                   
 61     /**                                           
 62      * Move constructor. */                       
 63     Point3D(Point3D<float> &&) = default;         
 64                                                   
 65     /**                                           
 66      * Constructor from BasicVector3D<float>.     
 67     Point3D(const BasicVector3D<float> & v) :     
 68                                                   
 69     /**                                           
 70      * Destructor. */                             
 71     ~Point3D() = default;                         
 72                                                   
 73     /**                                           
 74      * Assignment. */                             
 75     Point3D<float> & operator=(const Point3D<f    
 76                                                   
 77     /**                                           
 78      * Assignment from BasicVector3D<float>. *    
 79     Point3D<float> & operator=(const BasicVect    
 80       this->BasicVector3D<float>::operator=(v)    
 81       return *this;                               
 82     }                                             
 83                                                   
 84     /**                                           
 85      * Move assignment. */                        
 86     Point3D<float> & operator=(Point3D<float>     
 87                                                   
 88     /**                                           
 89      * Returns distance to the origin squared.    
 90     float distance2() const { return mag2(); }    
 91                                                   
 92     /**                                           
 93      * Returns distance to the point squared.     
 94     float distance2(const Point3D<float> & p)     
 95       float dx = p.x()-x(), dy = p.y()-y(), dz    
 96       return dx*dx + dy*dy + dz*dz;               
 97     }                                             
 98                                                   
 99     /**                                           
100      * Returns distance to the origin. */         
101     float distance() const { return std::sqrt(    
102                                                   
103     /**                                           
104      * Returns distance to the point. */          
105     float distance(const Point3D<float> & p) c    
106       return std::sqrt(distance2(p));             
107     }                                             
108                                                   
109     /**                                           
110      * Transformation by Transform3D. */          
111     Point3D<float> & transform(const Transform    
112   };                                              
113                                                   
114   /**                                             
115    * Transformation of Point3D<float> by Trans    
116    * @relates Point3D                             
117    */                                             
118   Point3D<float>                                  
119   operator*(const Transform3D & m, const Point    
120                                                   
121   /**                                             
122    * Geometrical 3D Point with components of d    
123    *                                              
124    * @author Evgeni Chernyaev <Evgueni.Tcherni    
125    * @ingroup geometry                            
126    */                                             
127   template<>                                      
128   class Point3D<double> : public BasicVector3D    
129   public:                                         
130     /**                                           
131      * Default constructor. */                    
132     Point3D() = default;                          
133                                                   
134     /**                                           
135      * Constructor from three numbers. */         
136     Point3D(double x1, double y1, double z1) :    
137                                                   
138     /**                                           
139      * Constructor from array of floats. */       
140     explicit Point3D(const float * a)             
141       : BasicVector3D<double>(a[0],a[1],a[2])     
142                                                   
143     /**                                           
144      * Constructor from array of doubles. */      
145     explicit Point3D(const double * a)            
146       : BasicVector3D<double>(a[0],a[1],a[2])     
147                                                   
148     /**                                           
149      * Copy constructor. */                       
150     Point3D(const Point3D<double> &) = default    
151                                                   
152     /**                                           
153      * Move constructor. */                       
154     Point3D(Point3D<double> &&) = default;        
155                                                   
156     /**                                           
157      * Constructor from BasicVector3D<float>.     
158     Point3D(const BasicVector3D<float> & v) :     
159                                                   
160     /**                                           
161      * Constructor from BasicVector3D<double>.    
162     Point3D(const BasicVector3D<double> & v) :    
163                                                   
164     /**                                           
165      * Destructor. */                             
166     ~Point3D() = default;                         
167                                                   
168     /**                                           
169      * Constructor from CLHEP::Hep3Vector.        
170      * This constructor is needed only for bac    
171      * in principle should be absent.             
172      */                                           
173     Point3D(const CLHEP::Hep3Vector & v)          
174       : BasicVector3D<double>(v.x(),v.y(),v.z(    
175                                                   
176     /**                                           
177      * Conversion (cast) to CLHEP::Hep3Vector.    
178      * This operator is needed only for backwa    
179      * in principle should not exit.              
180      */                                           
181     operator CLHEP::Hep3Vector () const { retu    
182                                                   
183     /**                                           
184      * Assignment. */                             
185     Point3D<double> & operator=(const Point3D<    
186                                                   
187     /**                                           
188      * Assignment from BasicVector3D<float>. *    
189     Point3D<double> & operator=(const BasicVec    
190       this->BasicVector3D<double>::operator=(v    
191       return *this;                               
192     }                                             
193                                                   
194     /**                                           
195      * Assignment from BasicVector3D<double>.     
196     Point3D<double> & operator=(const BasicVec    
197       this->BasicVector3D<double>::operator=(v    
198       return *this;                               
199     }                                             
200                                                   
201     /**                                           
202      * Move assignment. */                        
203     Point3D<double> & operator=(Point3D<double    
204                                                   
205     /**                                           
206      * Returns distance to the origin squared.    
207     double distance2() const { return mag2();     
208                                                   
209     /**                                           
210      * Returns distance to the point squared.     
211     double distance2(const Point3D<double> & p    
212       double dx = p.x()-x(), dy = p.y()-y(), d    
213       return dx*dx + dy*dy + dz*dz;               
214     }                                             
215                                                   
216     /**                                           
217      * Returns distance to the origin. */         
218     double distance() const { return std::sqrt    
219                                                   
220     /**                                           
221      * Returns distance to the point. */          
222     double distance(const Point3D<double> & p)    
223       return std::sqrt(distance2(p));             
224     }                                             
225                                                   
226     /**                                           
227      * Transformation by Transform3D. */          
228     Point3D<double> & transform(const Transfor    
229   };                                              
230                                                   
231   /**                                             
232    * Transformation of Point3D<double> by Tran    
233    * @relates Point3D                             
234    */                                             
235   Point3D<double>                                 
236   operator*(const Transform3D & m, const Point    
237                                                   
238 } /* namespace HepGeom */                         
239                                                   
240 #endif /* HEP_POINT3D_H */                        
241