Point3D.cc

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

Generated on Mon May 27 17:50:32 2013 for Geant4 by  doxygen 1.4.7