// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // History: // 09.09.96 E.Chernyaev - initial version // 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple // the functionality from CLHEP::Hep3Vector // 01.04.03 E.Chernyaev - CLHEP-1.9: template version // #ifndef HEP_NORMAL3D_H #define HEP_NORMAL3D_H #include #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Geometry/BasicVector3D.h" namespace HepGeom { class Transform3D; /** * Geometrical 3D Normal. * This is just a declaration of the class needed to define * specializations Normal3D and Normal3D. * * @ingroup geometry * @author Evgeni Chernyaev */ template class Normal3D : public BasicVector3D {}; /** * Geometrical 3D Normal with components of float type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Normal3D : public BasicVector3D { public: /** * Default constructor. */ Normal3D() = default; /** * Constructor from three numbers. */ Normal3D(float x1, float y1, float z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Normal3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Normal3D(const Normal3D &) = default; /** * Move constructor. */ Normal3D(Normal3D &&) = default; /** * Constructor from BasicVector3D. */ Normal3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Normal3D() = default; /** * Assignment. */ Normal3D & operator=(const Normal3D &) = default; /** * Assignment from BasicVector3D. */ Normal3D & operator=(const BasicVector3D & v) { this->BasicVector3D::operator=(v); return *this; } /** * Move assignment. */ Normal3D & operator=(Normal3D &&) = default; /** * Transformation by Transform3D. */ Normal3D & transform(const Transform3D & m); }; /** * Transformation of Normal by Transform3D. * @relates Normal3D */ Normal3D operator*(const Transform3D & m, const Normal3D & n); /** * Geometrical 3D Normal with components of double type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Normal3D : public BasicVector3D { public: /** * Default constructor. */ Normal3D() = default; /** * Constructor from three numbers. */ Normal3D(double x1, double y1, double z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Normal3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Constructor from array of doubles. */ explicit Normal3D(const double * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Normal3D(const Normal3D &) = default; /** * Move constructor. */ Normal3D(Normal3D &&) = default; /** * Constructor from BasicVector3D. */ Normal3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Normal3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Normal3D() = default; /** * Constructor from CLHEP::Hep3Vector. * This constructor is needed only for backward compatibility and * in principle should be absent. */ Normal3D(const CLHEP::Hep3Vector & v) : BasicVector3D(v.x(),v.y(),v.z()) {} /** * Conversion (cast) to CLHEP::Hep3Vector. * This operator is needed only for backward compatibility and * in principle should not exit. */ operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); } /** * Assignment. */ Normal3D & operator=(const Normal3D &) = default; /** * Assignment from BasicVector3D. */ Normal3D & operator=(const BasicVector3D & v) { this->BasicVector3D::operator=(v); return *this; } /** * Assignment from BasicVector3D. */ Normal3D & operator=(const BasicVector3D & v) { this->BasicVector3D::operator=(v); return *this; } /** * Move assignment. */ Normal3D & operator=(Normal3D &&) = default; /** * Transformation by Transform3D. */ Normal3D & transform(const Transform3D & m); }; /** * Transformation of Normal by Transform3D. * @relates Normal3D */ Normal3D operator*(const Transform3D & m, const Normal3D & n); } /* namespace HepGeom */ #endif /* HEP_NORMAL3D_H */