2// ---------------------------------------------------------------------------
4#include "CLHEP/Vector/ThreeVector.h"
5#include "CLHEP/Vector/Rotation.h"
6#include "CLHEP/Geometry/Point3D.h"
7#include "CLHEP/Geometry/Vector3D.h"
8#include "CLHEP/Geometry/Normal3D.h"
12// I N L I N E S F O R T R A N S F O R M A T I O N
15Transform3D::Transform3D_row::Transform3D_row
16(const Transform3D & r, int i) : rr(r), ii(i) {}
19double Transform3D::Transform3D_row::operator[](int jj) const {
24const Transform3D::Transform3D_row Transform3D::operator[](int i) const {
25 return Transform3D_row(*this, i);
29Transform3D::Transform3D(const CLHEP::HepRotation & mt, const CLHEP::Hep3Vector & v) {
30 xx_= mt.xx(); xy_= mt.xy(); xz_= mt.xz();
31 yx_= mt.yx(); yy_= mt.yy(); yz_= mt.yz();
32 zx_= mt.zx(); zy_= mt.zy(); zz_= mt.zz();
33 dx_= v.x(); dy_= v.y(); dz_= v.z();
38Transform3D::getRotation() const {
39 CLHEP::HepRotation mt;
40 return mt.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_),
41 CLHEP::Hep3Vector(xy_,yy_,zy_),
42 CLHEP::Hep3Vector(xz_,yz_,zz_));
47Transform3D::getTranslation() const {
48 return CLHEP::Hep3Vector(dx_,dy_,dz_);
51// I N L I N E S F O R R O T A T I O N
54Rotate3D::Rotate3D(const CLHEP::HepRotation & mt) {
55 xx_= mt.xx(); xy_= mt.xy(); xz_= mt.xz();
56 yx_= mt.yx(); yy_= mt.yy(); yz_= mt.yz();
57 zx_= mt.zx(); zy_= mt.zy(); zz_= mt.zz();
58 dx_= 0; dy_= 0; dz_= 0;
62Rotate3D::Rotate3D(double a, const Vector3D<double> & v) {
64 Rotate3D(a, Point3D<double>(0,0,0), Point3D<double>(v.x(),v.y(),v.z()));
68Rotate3D::Rotate3D(const Point3D<double> & fr1, const Point3D<double> & fr2,
69 const Point3D<double> & to1, const Point3D<double> & to2)
70 : Transform3D(Point3D<double>(0,0,0),fr1,fr2,
71 Point3D<double>(0,0,0),to1,to2) {}
73// I N L I N E S F O R T R A N S L A T I O N
76Translate3D::Translate3D(const CLHEP::Hep3Vector & v)
77 : Transform3D(1,0,0,v.x(), 0,1,0,v.y(), 0,0,1,v.z()) {}
79// I N L I N E S F O R R E F L E C T I O N
82Reflect3D::Reflect3D(const Normal3D<double> & n, const Point3D<double> & p) {
83 *this = Reflect3D(n.x(), n.y(), n.z(), -n*p);
86} /* namespace HepGeom */