CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Vector3D.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Vector3D.cc,v 1.3 2003/08/13 20:00:11 garren Exp $
00003 // ---------------------------------------------------------------------------
00004 
00005 #include "CLHEP/Geometry/defs.h"
00006 #include "CLHEP/Geometry/Vector3D.h"
00007 #include "CLHEP/Geometry/Transform3D.h"
00008 
00009 namespace HepGeom {
00010   //--------------------------------------------------------------------------
00011   Vector3D<float> &
00012   Vector3D<float>::transform(const Transform3D & m) {
00013     double vx = x(), vy = y(), vz = z();
00014     set(m.xx()*vx + m.xy()*vy + m.xz()*vz,
00015         m.yx()*vx + m.yy()*vy + m.yz()*vz,
00016         m.zx()*vx + m.zy()*vy + m.zz()*vz);
00017     return *this;
00018   }
00019 
00020   //--------------------------------------------------------------------------
00021   Vector3D<float>
00022   operator*(const Transform3D & m, const Vector3D<float> & v) {
00023     double vx = v.x(), vy = v.y(), vz = v.z();
00024     return Vector3D<float>
00025       (m.xx()*vx + m.xy()*vy + m.xz()*vz,
00026        m.yx()*vx + m.yy()*vy + m.yz()*vz,
00027        m.zx()*vx + m.zy()*vy + m.zz()*vz);
00028   }
00029 
00030   //--------------------------------------------------------------------------
00031   Vector3D<double> &
00032   Vector3D<double>::transform(const Transform3D & m) {
00033     double vx = x(), vy = y(), vz = z();
00034     set(m.xx()*vx + m.xy()*vy + m.xz()*vz,
00035         m.yx()*vx + m.yy()*vy + m.yz()*vz,
00036         m.zx()*vx + m.zy()*vy + m.zz()*vz);
00037     return *this;
00038   }
00039 
00040   //--------------------------------------------------------------------------
00041   Vector3D<double>
00042   operator*(const Transform3D & m, const Vector3D<double> & v) {
00043     double vx = v.x(), vy = v.y(), vz = v.z();
00044     return Vector3D<double>
00045       (m.xx()*vx + m.xy()*vy + m.xz()*vz,
00046        m.yx()*vx + m.yy()*vy + m.yz()*vz,
00047        m.zx()*vx + m.zy()*vy + m.zz()*vz);
00048   }
00049 } /* namespace HepGeom */

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7