|
|
[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] |
||||
|   | ||||||
|
||||||
001 // -*- C++ -*- 002 // $Id: Point3D.h,v 1.9 2002/05/07 16:38:52 mf Exp $ 003 // --------------------------------------------------------------------------- 004 // 005 // This file is a part of the CLHEP - a Class Library for High Energy Physics. 006 // 007 // History: 008 // 09.09.96 E.Chernyaev - initial version 009 // 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple 010 // the functionality from Hep3Vector 011 // 012 013 #ifndef HEP_POINT3D_H 014 #define HEP_POINT3D_H 015 016 #include "CLHEP/config/CLHEP.h" 017 #include "CLHEP/Geometry/BasicVector3D.h" 018 019 class HepTransform3D; 020 021 /** 022 * Geometrical 3D Point with components of double type. 023 * HepPoint3D, HepVector3D and HepNormal3D have very similar 024 * set of member functions. The difference among these classes 025 * is how they are transformed by HepTransform3D. 026 * 027 * @see BasicVector3D 028 * @author <Evgueni.Tcherniaev@cern.ch> 029 * @ingroup geometry 030 */ 031 class HepPoint3D : public BasicVector3D { 032 public: 033 /// Default constructor. 034 HepPoint3D() {} 035 036 /// Constructor from three doubles. 037 HepPoint3D(double x, double y, double z) : BasicVector3D(x,y,z) {} 038 039 /// Constructor from base class. 040 HepPoint3D(const BasicVector3D & v) : BasicVector3D(v) {} 041 042 /** 043 * Constructor from Hep3Vector. 044 * This constructor is needed only for backward compatibility and 045 * in principle should be absent. 046 */ 047 HepPoint3D(const Hep3Vector & v) : BasicVector3D(v) {} 048 049 /// Destructor. 050 ~HepPoint3D() {} 051 052 /// Assignment. 053 HepPoint3D & operator=(const HepPoint3D & v) { 054 set(v.x(),v.y(),v.z()); return *this; 055 } 056 057 /// Assignment from BasicVector3D and 058 /// classes derived from it: HepVector3D, HepNormal3D. 059 HepPoint3D & operator=(const BasicVector3D & v) { 060 set(v.x(),v.y(),v.z()); return *this; 061 } 062 063 /// Returns distance to the origin squared. 064 double distance2() const { return mag2(); } 065 066 /// Returns distance to the point squared. 067 double distance2(const HepPoint3D & p) const { 068 double delx = p.x()-x(), dely = p.y()-y(), delz = p.z()-z(); 069 return delx*delx + dely*dely + delz*delz; 070 } 071 072 /// Returns distance to the origin. 073 double distance() const { return sqrt(distance2()); } 074 075 /// Returns distance to the point. 076 double distance(const HepPoint3D & p) const { return sqrt(distance2(p)); } 077 078 /// Transformation by HepTransform3D. 079 HepPoint3D & transform(const HepTransform3D &m); 080 }; 081 082 #include "CLHEP/Geometry/Transform3D.h" 083 084 inline HepPoint3D & HepPoint3D::transform(const HepTransform3D & m) { 085 return *this = m * (*this); 086 } 087 088 #endif /* HEP_POINT3D_H */
| [ source navigation ] | [ diff markup ] | [ identifier search ] | [ freetext search ] | [ file search ] |
| This page was automatically generated by the LXR engine. The LXR team |
|