Geant4  10.00.p02
Normal3D.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:$
3 // ---------------------------------------------------------------------------
4 
5 #include "CLHEP/Geometry/Normal3D.h"
6 #include "CLHEP/Geometry/Transform3D.h"
7 
8 namespace HepGeom {
9  //--------------------------------------------------------------------------
10  Normal3D<float> &
11  Normal3D<float>::transform(const Transform3D & m) {
12  double vx = x(), vy = y(), vz = z();
13  double xx = m.xx(), xy = m.xy(), xz = m.xz();
14  double yx = m.yx(), yy = m.yy(), yz = m.yz();
15  double zx = m.zx(), zy = m.zy(), zz = m.zz();
16  set((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz,
17  (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz,
18  (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz);
19  return *this;
20  }
21 
22  //--------------------------------------------------------------------------
23  Normal3D<float>
24  operator*(const Transform3D & m, const Normal3D<float> & v) {
25  double vx = v.x(), vy = v.y(), vz = v.z();
26  double xx = m.xx(), xy = m.xy(), xz = m.xz();
27  double yx = m.yx(), yy = m.yy(), yz = m.yz();
28  double zx = m.zx(), zy = m.zy(), zz = m.zz();
29  return Normal3D<float>
30  ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz,
31  (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz,
32  (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz);
33  }
34 
35  //--------------------------------------------------------------------------
36  Normal3D<double> &
37  Normal3D<double>::transform(const Transform3D & m) {
38  double vx = x(), vy = y(), vz = z();
39  double xx = m.xx(), xy = m.xy(), xz = m.xz();
40  double yx = m.yx(), yy = m.yy(), yz = m.yz();
41  double zx = m.zx(), zy = m.zy(), zz = m.zz();
42  set((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz,
43  (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz,
44  (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz);
45  return *this;
46  }
47 
48  //--------------------------------------------------------------------------
49  Normal3D<double>
50  operator*(const Transform3D & m, const Normal3D<double> & v) {
51  double vx = v.x(), vy = v.y(), vz = v.z();
52  double xx = m.xx(), xy = m.xy(), xz = m.xz();
53  double yx = m.yx(), yy = m.yy(), yz = m.yz();
54  double zx = m.zx(), zy = m.zy(), zz = m.zz();
55  return Normal3D<double>
56  ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz,
57  (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz,
58  (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz);
59  }
60 } /* namespace HepGeom */
G4double z
Definition: TRTMaterials.hh:39
static const double m
Definition: G4SIunits.hh:110
Normal3D< float > operator*(const Transform3D &m, const Normal3D< float > &v)
Definition: Normal3D.cc:24