Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:36

0001 // -*- C++ -*-
0002 // $Id: Transform3D.icc,v 1.1 2003/07/17 09:05:28 garren Exp $
0003 // ---------------------------------------------------------------------------
0004 
0005 #include "CLHEP/Vector/ThreeVector.h"
0006 #include "CLHEP/Vector/Rotation.h"
0007 #include "CLHEP/Geometry/Point3D.h"
0008 #include "CLHEP/Geometry/Vector3D.h"
0009 #include "CLHEP/Geometry/Normal3D.h"
0010 
0011 namespace HepGeom {
0012 
0013 //   I N L I N E S   F O R   T R A N S F O R M A T I O N
0014 
0015 inline
0016 Transform3D::Transform3D_row::Transform3D_row
0017 (const Transform3D & r, int i) : rr(r), ii(i) {}
0018 
0019 inline
0020 double Transform3D::Transform3D_row::operator[](int jj) const {
0021   return rr(ii,jj);
0022 }
0023 
0024 inline
0025 const Transform3D::Transform3D_row Transform3D::operator[](int i) const {
0026   return Transform3D_row(*this, i);
0027 }
0028 
0029 inline
0030 Transform3D::Transform3D(const CLHEP::HepRotation & mt, const CLHEP::Hep3Vector & v) {
0031   xx_= mt.xx(); xy_= mt.xy(); xz_= mt.xz();
0032   yx_= mt.yx(); yy_= mt.yy(); yz_= mt.yz();
0033   zx_= mt.zx(); zy_= mt.zy(); zz_= mt.zz();
0034   dx_= v.x();  dy_= v.y();  dz_= v.z();
0035 }
0036 
0037 inline
0038 CLHEP::HepRotation
0039 Transform3D::getRotation() const {
0040   CLHEP::HepRotation mt;
0041   return mt.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_),
0042                        CLHEP::Hep3Vector(xy_,yy_,zy_),
0043                        CLHEP::Hep3Vector(xz_,yz_,zz_));
0044 }
0045 
0046 inline
0047 CLHEP::Hep3Vector
0048 Transform3D::getTranslation() const {
0049   return CLHEP::Hep3Vector(dx_,dy_,dz_); 
0050 }
0051 
0052 //   I N L I N E S   F O R   R O T A T I O N
0053 
0054 inline
0055 Rotate3D::Rotate3D(const CLHEP::HepRotation & mt) {
0056   xx_= mt.xx(); xy_= mt.xy(); xz_= mt.xz();
0057   yx_= mt.yx(); yy_= mt.yy(); yz_= mt.yz();
0058   zx_= mt.zx(); zy_= mt.zy(); zz_= mt.zz();
0059   dx_= 0;      dy_= 0;      dz_= 0;
0060 }
0061 
0062 inline
0063 Rotate3D::Rotate3D(double a, const Vector3D<double> & v) {
0064   *this =
0065     Rotate3D(a, Point3D<double>(0,0,0), Point3D<double>(v.x(),v.y(),v.z()));
0066 }
0067 
0068 inline
0069 Rotate3D::Rotate3D(const Point3D<double> & fr1, const Point3D<double> & fr2,
0070            const Point3D<double> & to1, const Point3D<double> & to2)
0071   : Transform3D(Point3D<double>(0,0,0),fr1,fr2,
0072         Point3D<double>(0,0,0),to1,to2) {}
0073 
0074 //   I N L I N E S   F O R   T R A N S L A T I O N
0075 
0076 inline
0077 Translate3D::Translate3D(const CLHEP::Hep3Vector & v)
0078   : Transform3D(1,0,0,v.x(), 0,1,0,v.y(), 0,0,1,v.z()) {}
0079 
0080 //   I N L I N E S   F O R   R E F L E C T I O N
0081 
0082 inline
0083 Reflect3D::Reflect3D(const Normal3D<double> & n, const Point3D<double> & p) {
0084   *this = Reflect3D(n.x(), n.y(), n.z(), -n*p);
0085 }
0086 
0087 } /* namespace HepGeom */