Transform3D.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:$
3 // ---------------------------------------------------------------------------
4 //
5 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
6 //
7 // Hep geometrical 3D Transformation class
8 //
9 // Author: Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch>
10 //
11 // ******************************************
12 // * *
13 // * Transform *
14 // * / / \ \ *
15 // * -------- / \ -------- *
16 // * / / \ \ *
17 // * Rotate Translate Reflect Scale *
18 // * / | \ / | \ / | \ / | \ *
19 // * X Y Z X Y Z X Y Z X Y Z *
20 // * *
21 // ******************************************
22 //
23 // Identity transformation:
24 // Transform3D::Identity - global identity transformation;
25 // any constructor without parameters, e.g. Transform3D();
26 // m.setIdentity() - set "m" to identity;
27 //
28 // General transformations:
29 // Transform3D(m,v) - transformation given by Rotation "m"
30 // and CLHEP::Hep3Vector "v";
31 // Transform3D(a0,a1,a2, b0,b1,b2) - transformation given by initial
32 // and transformed positions of three points;
33 // Rotations:
34 // Rotate3D(m) - rotation given by CLHEP::HepRotation "m";
35 // Rotate3D(ang,v) - rotation through the angle "ang" around
36 // vector "v";
37 // Rotate3D(ang,p1,p2) - rotation through the angle "ang"
38 // counterclockwise around the axis given by
39 // two points p1->p2;
40 // Rotate3D(a1,a2, b1,b2) - rotation around the origin defined by initial
41 // and transformed positions of two points;
42 // RotateX3D(ang) - rotation around X-axis;
43 // RotateY3D(ang) - rotation around Y-axis;
44 // RotateZ3D(ang) - rotation around Z-axis;
45 //
46 // Translations:
47 // Translate3D(v) - translation given by CLHEP::Hep3Vector "v";
48 // Translate3D(dx,dy,dz) - translation on vector (dx,dy,dz);
49 // TraslateX3D(dx) - translation along X-axis;
50 // TraslateY3D(dy) - translation along Y-axis;
51 // TraslateZ3D(dz) - translation along Z-axis;
52 //
53 // Reflections:
54 // Reflect3D(a,b,c,d) - reflection in the plane a*x+b*y+c*z+d=0;
55 // Reflect3D(normal,p) - reflection in the plane going through "p"
56 // and whose normal is equal to "normal";
57 // ReflectX3D(a) - reflect X in the plane x=a (default a=0);
58 // ReflectY3D(a) - reflect Y in the plane y=a (default a=0);
59 // ReflectZ3D(a) - reflect Z in the plane z=a (default a=0);
60 //
61 // Scalings:
62 // Scale3D(sx,sy,sz) - general scaling with factors "sx","sy","sz"
63 // along X, Y and Z;
64 // Scale3D(s) - scaling with constant factor "s" along all
65 // directions;
66 // ScaleX3D(sx) - scale X;
67 // ScaleY3D(sy) - scale Y;
68 // ScaleZ3D(sz) - scale Z;
69 //
70 // Inverse transformation:
71 // m.inverse() or - returns inverse transformation;
72 //
73 // Compound transformation:
74 // m3 = m2 * m1 - it is relatively slow in comparison with
75 // transformation of a vector. Use parenthesis
76 // to avoid this operation (see example below);
77 // Transformation of point:
78 // p2 = m * p1
79 //
80 // Transformation of vector:
81 // v2 = m * v1
82 //
83 // Transformation of normal:
84 // n2 = m * n1
85 //
86 // The following table explains how different transformations affect
87 // point, vector and normal. "+" means affect, "-" means do not affect,
88 // "*" meas affect but in different way than "+"
89 //
90 // Point Vector Normal
91 // -------------+-------+-------+-------
92 // Rotation ! + ! + ! +
93 // Translation ! + ! - ! -
94 // Reflection ! + ! + ! *
95 // Scaling ! + ! + ! *
96 // -------------+-------+-------+-------
97 //
98 // Example of the usage:
99 //
100 // Transform3D m1, m2, m3;
101 // HepVector3D v2, v1(0,0,0);
102 //
103 // m1 = Rotate3D(angle, Vector3D(1,1,1));
104 // m2 = Translate3D(dx,dy,dz);
105 // m3 = m1.inverse();
106 //
107 // v2 = m3*(m2*(m1*v1));
108 //
109 // History:
110 // 24.09.96 E.Chernyaev - initial version
111 //
112 // 26.02.97 E.Chernyaev
113 // - added global Identity by request of John Allison
114 // (to avoid problems with compilation on HP)
115 // - added getRotation and getTranslation
116 //
117 // 29.01.01 E.Chernyaev - added subscripting
118 // 11.06.01 E.Chernyaev - added getDecomposition
119 
120 #ifndef HEP_TRANSFROM3D_H
121 #define HEP_TRANSFROM3D_H
122 
124 
125 namespace HepGeom {
126 
127  template<class T> class Point3D;
128  template<class T> class Vector3D;
129  template<class T> class Normal3D;
130 
131  class Translate3D;
132  class Rotate3D;
133  class Scale3D;
134 
135  /**
136  * Class for transformation of 3D geometrical objects.
137  * It allows different translations, rotations, scalings and reflections.
138  * Several specialized classes are derived from it:
139  *
140  * TranslateX3D, TranslateY3D, TranslateZ3D, Translate3D,<br>
141  * RotateX3D, RotateY3D, RotateZ3D, Rotate3D, <br>
142  * ScaleX3D, ScaleY3D, ScaleZ3D, Scale3D, <br>
143  * ReflectX3D, ReflectY3D, ReflectZ3D, Reflect3D.
144  *
145  * The idea behind these classes is to provide some additional constructors
146  * for Transform3D, they normally should not be used as separate classes.
147  *
148  * Example:
149  * @code
150  * HepGeom::Transform3D m;
151  * m = HepGeom::TranslateX3D(10.*cm);
152  * @endcode
153  *
154  * Remark:
155  * For the reason that the operator* is left associative, the notation
156  * @code
157  * v2 = m3*(m2*(m1*v1));
158  * @endcode
159  * is much more effective then the notation
160  * @code
161  * v2 = m3*m2*m1*v1;
162  * @endcode
163  * In the first case three operations Transform3D*Vector3D are executed,
164  * in the second case two operations Transform3D*Transform3D and one
165  * Transform3D*Vector3D are performed. Transform3D*Transform3D is
166  * roughly three times slower than Transform3D*Vector3D.
167  *
168  * @author <Evgueni.Tcherniaev@cern.ch>
169  * @ingroup geometry
170  */
171  class Transform3D {
172  protected:
173  double xx_, xy_, xz_, dx_, // 4x3 Transformation Matrix
174  yx_, yy_, yz_, dy_,
175  zx_, zy_, zz_, dz_;
176 
177  // Protected constructor
178  Transform3D(double XX, double XY, double XZ, double DX,
179  double YX, double YY, double YZ, double DY,
180  double ZX, double ZY, double ZZ, double DZ)
181  : xx_(XX), xy_(XY), xz_(XZ), dx_(DX),
182  yx_(YX), yy_(YY), yz_(YZ), dy_(DY),
183  zx_(ZX), zy_(ZY), zz_(ZZ), dz_(DZ) {}
184 
185  // Set transformation matrix
186  void setTransform(double XX, double XY, double XZ, double DX,
187  double YX, double YY, double YZ, double DY,
188  double ZX, double ZY, double ZZ, double DZ) {
189  xx_ = XX; xy_ = XY; xz_ = XZ; dx_ = DX;
190  yx_ = YX; yy_ = YY; yz_ = YZ; dy_ = DY;
191  zx_ = ZX; zy_ = ZY; zz_ = ZZ; dz_ = DZ;
192  }
193 
194  public:
195  /**
196  * Global identity transformation. */
198 
199  // Helper class for implemention of C-style subscripting r[i][j]
201  public:
202  inline Transform3D_row(const Transform3D &, int);
203  inline double operator [] (int) const;
204  private:
205  const Transform3D & rr;
206  int ii;
207  };
208 
209  /**
210  * Default constructor - sets the Identity transformation. */
212  : xx_(1), xy_(0), xz_(0), dx_(0),
213  yx_(0), yy_(1), yz_(0), dy_(0),
214  zx_(0), zy_(0), zz_(1), dz_(0) {}
215 
216  /**
217  * Constructor: rotation and then translation. */
218  inline Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v);
219 
220  /**
221  * Constructor: transformation of basis (assumed - no reflection). */
222  Transform3D(const Point3D<double> & fr0,
223  const Point3D<double> & fr1,
224  const Point3D<double> & fr2,
225  const Point3D<double> & to0,
226  const Point3D<double> & to1,
227  const Point3D<double> & to2);
228 
229  /**
230  * Copy constructor. */
232  : xx_(m.xx_), xy_(m.xy_), xz_(m.xz_), dx_(m.dx_),
233  yx_(m.yx_), yy_(m.yy_), yz_(m.yz_), dy_(m.dy_),
234  zx_(m.zx_), zy_(m.zy_), zz_(m.zz_), dz_(m.dz_) {}
235 
236  /**
237  * Destructor.
238  * Virtual for now as some persistency mechanism needs that,
239  * in future releases this might go away again.
240  */
241  ~Transform3D() { /* nop */ }
242 
243  /**
244  * Returns object of the helper class for C-style subscripting r[i][j] */
245  inline const Transform3D_row operator [] (int) const;
246 
247  /** Fortran-style subscripting: returns (i,j) element of the matrix. */
248  double operator () (int, int) const;
249 
250  /**
251  * Gets xx-element of the transformation matrix. */
252  double xx() const { return xx_; }
253  /**
254  * Gets xy-element of the transformation matrix. */
255  double xy() const { return xy_; }
256  /**
257  * Gets xz-element of the transformation matrix. */
258  double xz() const { return xz_; }
259  /**
260  * Gets yx-element of the transformation matrix. */
261  double yx() const { return yx_; }
262  /**
263  * Gets yy-element of the transformation matrix. */
264  double yy() const { return yy_; }
265  /**
266  * Gets yz-element of the transformation matrix. */
267  double yz() const { return yz_; }
268  /**
269  * Gets zx-element of the transformation matrix. */
270  double zx() const { return zx_; }
271  /**
272  * Gets zy-element of the transformation matrix. */
273  double zy() const { return zy_; }
274  /**
275  * Gets zz-element of the transformation matrix. */
276  double zz() const { return zz_; }
277  /**
278  * Gets dx-element of the transformation matrix. */
279  double dx() const { return dx_; }
280  /**
281  * Gets dy-element of the transformation matrix. */
282  double dy() const { return dy_; }
283  /**
284  * Gets dz-element of the transformation matrix. */
285  double dz() const { return dz_; }
286 
287  /**
288  * Assignment. */
290  xx_= m.xx_; xy_= m.xy_; xz_= m.xz_; dx_= m.dx_;
291  yx_= m.yx_; yy_= m.yy_; yz_= m.yz_; dy_= m.dy_;
292  zx_= m.zx_; zy_= m.zy_; zz_= m.zz_; dz_= m.dz_;
293  return *this;
294  }
295 
296  /**
297  * Sets the Identity transformation. */
298  void setIdentity() {
299  xy_= xz_= dx_= yx_= yz_= dy_= zx_= zy_= dz_= 0; xx_= yy_= zz_= 1;
300  }
301 
302  /**
303  * Returns the inverse transformation. */
304  Transform3D inverse() const;
305 
306  /**
307  * Transformation by another Transform3D. */
308  Transform3D operator*(const Transform3D & b) const;
309 
310  /**
311  * Decomposition of general transformation.
312  * This function gets decomposition of the transformation
313  * in three consequentive specific transformations: Scale3D,
314  * then Rotate3D, then Translate3, i.e.
315  * @code
316  * Transform3D = Translate3D * Rotate3D * Scale3D
317  * @endcode
318  *
319  * @param scale output: scaling transformation;
320  * if there was a reflection, then scale factor for
321  * z-component (scale(2,2)) will be negative.
322  * @param rotation output: rotation transformaion.
323  * @param translation output: translation transformaion.
324  */
326  Rotate3D & rotation,
327  Translate3D & translation) const;
328 
329  /**
330  * Returns true if the difference between corresponding
331  * matrix elements is less than the tolerance.
332  */
333  bool isNear(const Transform3D & t, double tolerance = 2.2E-14 ) const;
334 
335  /**
336  * Extracts the rotation matrix.
337  * This functions is obsolete - use getDecomposition() instead.
338  */
339  inline CLHEP::HepRotation getRotation() const;
340 
341  /**
342  * Extracts the translation vector.
343  * This functions is obsolete - use getDecomposition() instead.
344  */
345  inline CLHEP::Hep3Vector getTranslation() const;
346 
347  /**
348  * Test for equality. */
349  bool operator == (const Transform3D & transform) const;
350 
351  /**
352  * Test for inequality. */
353  bool operator != (const Transform3D & transform) const {
354  return ! operator==(transform);
355  }
356  };
357 
358  // R O T A T I O N S
359 
360  /**
361  * Constructs a rotation transformation.
362  * This class provides additional constructors for Transform3D
363  * and should not be used as a separate class.
364  *
365  * Example of use:
366  * @code
367  * Transform3D m;
368  * m = Rotate3D(30.*deg, HepVector3D(1.,1.,1.));
369  * @endcode
370  *
371  * @author <Evgueni.Tcherniaev@cern.ch>
372  * @ingroup geometry
373  */
374  class Rotate3D : public Transform3D {
375  public:
376  /**
377  * Default constructor: sets the Identity transformation. */
379 
380  /**
381  * Constructor from CLHEP::HepRotation. */
382  inline Rotate3D(const CLHEP::HepRotation &m);
383 
384  /**
385  * Constructor from angle and axis given by two points.
386  * @param a angle of rotation
387  * @param p1 begin point of the axis
388  * @param p2 end point of the axis
389  */
390  Rotate3D(double a,
391  const Point3D<double> & p1,
392  const Point3D<double> & p2);
393 
394  /**
395  * Constructor from angle and axis.
396  * @param a angle of rotation
397  * @param v axis of rotation
398  */
399  inline Rotate3D(double a, const Vector3D<double> & v);
400 
401  /**
402  * Constructor for rotation given by original and rotated position of
403  * two points. It is assumed that there is no reflection.
404  * @param fr1 original position of 1st point
405  * @param fr2 original position of 2nd point
406  * @param to1 rotated position of 1st point
407  * @param to2 rotated position of 2nd point
408  */
409  inline Rotate3D(const Point3D<double> & fr1,
410  const Point3D<double> & fr2,
411  const Point3D<double> & to1,
412  const Point3D<double> & to2);
413  };
414 
415  /**
416  * Constructs a rotation around x-axis.
417  * This class provides additional constructors for Transform3D
418  * and should not be used as a separate class.
419  *
420  * Example of use:
421  * @code
422  * Transform3D m;
423  * m = RotateX3D(30.*deg);
424  * @endcode
425  *
426  * @author <Evgueni.Tcherniaev@cern.ch>
427  * @ingroup geometry
428  */
429  class RotateX3D : public Rotate3D {
430  public:
431  /**
432  * Default constructor: sets the Identity transformation. */
434 
435  /**
436  * Constructs a rotation around x-axis by angle a. */
437  RotateX3D(double a) {
438  double cosa = std::cos(a), sina = std::sin(a);
439  setTransform(1,0,0,0, 0,cosa,-sina,0, 0,sina,cosa,0);
440  }
441  };
442 
443  /**
444  * Constructs a rotation around y-axis.
445  * This class provides additional constructors for Transform3D
446  * and should not be used as a separate class.
447  *
448  * Example of use:
449  * @code
450  * Transform3D m;
451  * m = RotateY3D(30.*deg);
452  * @endcode
453  *
454  * @author <Evgueni.Tcherniaev@cern.ch>
455  * @ingroup geometry
456  */
457  class RotateY3D : public Rotate3D {
458  public:
459  /**
460  * Default constructor: sets the Identity transformation. */
462 
463  /**
464  * Constructs a rotation around y-axis by angle a. */
465  RotateY3D(double a) {
466  double cosa = std::cos(a), sina = std::sin(a);
467  setTransform(cosa,0,sina,0, 0,1,0,0, -sina,0,cosa,0);
468  }
469  };
470 
471  /**
472  * Constructs a rotation around z-axis.
473  * This class provides additional constructors for Transform3D
474  * and should not be used as a separate class.
475  *
476  * Example of use:
477  * @code
478  * Transform3D m;
479  * m = RotateZ3D(30.*deg);
480  * @endcode
481  *
482  * @author <Evgueni.Tcherniaev@cern.ch>
483  * @ingroup geometry
484  */
485  class RotateZ3D : public Rotate3D {
486  public:
487  /**
488  * Default constructor: sets the Identity transformation. */
490 
491  /**
492  * Constructs a rotation around z-axis by angle a. */
493  RotateZ3D(double a) {
494  double cosa = std::cos(a), sina = std::sin(a);
495  setTransform(cosa,-sina,0,0, sina,cosa,0,0, 0,0,1,0);
496  }
497  };
498 
499  // T R A N S L A T I O N S
500 
501  /**
502  * Constructs a translation transformation.
503  * This class provides additional constructors for Transform3D
504  * and should not be used as a separate class.
505  *
506  * Example of use:
507  * @code
508  * Transform3D m;
509  * m = Translate3D(10.,20.,30.);
510  * @endcode
511  *
512  * @author <Evgueni.Tcherniaev@cern.ch>
513  * @ingroup geometry
514  */
515  class Translate3D : public Transform3D {
516  public:
517  /**
518  * Default constructor: sets the Identity transformation. */
520 
521  /**
522  * Constructor from CLHEP::Hep3Vector. */
523  inline Translate3D(const CLHEP::Hep3Vector &v);
524 
525  /**
526  * Constructor from three numbers. */
527  Translate3D(double x, double y, double z)
528  : Transform3D(1,0,0,x, 0,1,0,y, 0,0,1,z) {}
529  };
530 
531  /**
532  * Constructs a translation along x-axis.
533  * This class provides additional constructors for Transform3D
534  * and should not be used as a separate class.
535  *
536  * Example of use:
537  * @code
538  * Transform3D m;
539  * m = TranslateX3D(10.);
540  * @endcode
541  *
542  * @author <Evgueni.Tcherniaev@cern.ch>
543  * @ingroup geometry
544  */
545  class TranslateX3D : public Translate3D {
546  public:
547  /**
548  * Default constructor: sets the Identity transformation. */
550 
551  /**
552  * Constructor from a number. */
553  TranslateX3D(double x) : Translate3D(x, 0, 0) {}
554  };
555 
556  /**
557  * Constructs a translation along y-axis.
558  * This class provides additional constructors for Transform3D
559  * and should not be used as a separate class.
560  *
561  * Example of use:
562  * @code
563  * Transform3D m;
564  * m = TranslateY3D(10.);
565  * @endcode
566  *
567  * @author <Evgueni.Tcherniaev@cern.ch>
568  * @ingroup geometry
569  */
570  class TranslateY3D : public Translate3D {
571  public:
572  /**
573  * Default constructor: sets the Identity transformation. */
575 
576  /**
577  * Constructor from a number. */
578  TranslateY3D(double y) : Translate3D(0, y, 0) {}
579  };
580 
581  /**
582  * Constructs a translation along z-axis.
583  * This class provides additional constructors for Transform3D
584  * and should not be used as a separate class.
585  *
586  * Example of use:
587  * @code
588  * Transform3D m;
589  * m = TranslateZ3D(10.);
590  * @endcode
591  *
592  * @author <Evgueni.Tcherniaev@cern.ch>
593  * @ingroup geometry
594  */
595  class TranslateZ3D : public Translate3D {
596  public:
597  /**
598  * Default constructor: sets the Identity transformation. */
600 
601  /**
602  * Constructor from a number. */
603  TranslateZ3D(double z) : Translate3D(0, 0, z) {}
604  };
605 
606  // R E F L E C T I O N S
607 
608  /**
609  * Constructs a reflection transformation.
610  * This class provides additional constructors for Transform3D
611  * and should not be used as a separate class.
612  *
613  * Example of use:
614  * @code
615  * Transform3D m;
616  * m = Reflect3D(1.,1.,1.,0.);
617  * @endcode
618  *
619  * @author <Evgueni.Tcherniaev@cern.ch>
620  * @ingroup geometry
621  */
622  class Reflect3D : public Transform3D {
623  protected:
624  Reflect3D(double XX, double XY, double XZ, double DX,
625  double YX, double YY, double YZ, double DY,
626  double ZX, double ZY, double ZZ, double DZ)
627  : Transform3D(XX,XY,XZ,DX, YX,YY,YZ,DY, ZX,ZY,ZZ,DZ) {}
628 
629  public:
630  /**
631  * Default constructor: sets the Identity transformation. */
633 
634  /**
635  * Constructor from four numbers.
636  * Sets reflection in a plane a*x+b*y+c*z+d=0
637  */
638  Reflect3D(double a, double b, double c, double d);
639 
640  /**
641  * Constructor from a plane given by its normal and origin. */
642  inline Reflect3D(const Normal3D<double> & normal,
643  const Point3D<double> & point);
644  };
645 
646  /**
647  * Constructs reflection in a plane x=const.
648  * This class provides additional constructors for Transform3D
649  * and should not be used as a separate class.
650  *
651  * Example of use:
652  * @code
653  * Transform3D m;
654  * m = ReflectX3D(1.);
655  * @endcode
656  *
657  * @author <Evgueni.Tcherniaev@cern.ch>
658  * @ingroup geometry
659  */
660  class ReflectX3D : public Reflect3D {
661  public:
662  /**
663  * Constructor from a number. */
664  ReflectX3D(double x=0) : Reflect3D(-1,0,0,x+x, 0,1,0,0, 0,0,1,0) {}
665  };
666 
667  /**
668  * Constructs reflection in a plane y=const.
669  * This class provides additional constructors for Transform3D
670  * and should not be used as a separate class.
671  *
672  * Example of use:
673  * @code
674  * Transform3D m;
675  * m = ReflectY3D(1.);
676  * @endcode
677  *
678  * @author <Evgueni.Tcherniaev@cern.ch>
679  * @ingroup geometry
680  */
681  class ReflectY3D : public Reflect3D {
682  public:
683  /**
684  * Constructor from a number. */
685  ReflectY3D(double y=0) : Reflect3D(1,0,0,0, 0,-1,0,y+y, 0,0,1,0) {}
686  };
687 
688  /**
689  * Constructs reflection in a plane z=const.
690  * This class provides additional constructors for Transform3D
691  * and should not be used as a separate class.
692  *
693  * Example of use:
694  * @code
695  * Transform3D m;
696  * m = ReflectZ3D(1.);
697  * @endcode
698  *
699  * @author <Evgueni.Tcherniaev@cern.ch>
700  * @ingroup geometry
701  */
702  class ReflectZ3D : public Reflect3D {
703  public:
704  /**
705  * Constructor from a number. */
706  ReflectZ3D(double z=0) : Reflect3D(1,0,0,0, 0,1,0,0, 0,0,-1,z+z) {}
707  };
708 
709  // S C A L I N G S
710 
711  /**
712  * Constructs a scaling transformation.
713  * This class provides additional constructors for Transform3D
714  * and should not be used as a separate class.
715  *
716  * Example of use:
717  * @code
718  * Transform3D m;
719  * m = Scale3D(2.);
720  * @endcode
721  *
722  * @author <Evgueni.Tcherniaev@cern.ch>
723  * @ingroup geometry
724  */
725  class Scale3D : public Transform3D {
726  public:
727  /**
728  * Default constructor: sets the Identity transformation. */
730 
731  /**
732  * Constructor from three numbers - scale factors in different directions.
733  */
734  Scale3D(double x, double y, double z)
735  : Transform3D(x,0,0,0, 0,y,0,0, 0,0,z,0) {}
736 
737  /**
738  * Constructor from a number: sets uniform scaling in all directions. */
739  Scale3D(double s)
740  : Transform3D(s,0,0,0, 0,s,0,0, 0,0,s,0) {}
741  };
742 
743  /**
744  * Constructs a scaling transformation in x-direction.
745  * This class provides additional constructors for Transform3D
746  * and should not be used as a separate class.
747  *
748  * Example of use:
749  * @code
750  * Transform3D m;
751  * m = ScaleX3D(2.);
752  * @endcode
753  *
754  * @author <Evgueni.Tcherniaev@cern.ch>
755  * @ingroup geometry
756  */
757  class ScaleX3D : public Scale3D {
758  public:
759  /**
760  * Default constructor: sets the Identity transformation. */
761  ScaleX3D() : Scale3D() {}
762 
763  /**
764  * Constructor from a number (scale factor in x-direction). */
765  ScaleX3D(double x) : Scale3D(x, 1, 1) {}
766  };
767 
768  /**
769  * Constructs a scaling transformation in y-direction.
770  * This class provides additional constructors for Transform3D
771  * and should not be used as a separate class.
772  *
773  * Example of use:
774  * @code
775  * Transform3D m;
776  * m = ScaleY3D(2.);
777  * @endcode
778  *
779  * @author <Evgueni.Tcherniaev@cern.ch>
780  * @ingroup geometry
781  */
782  class ScaleY3D : public Scale3D {
783  public:
784  /**
785  * Default constructor: sets the Identity transformation. */
786  ScaleY3D() : Scale3D() {}
787 
788  /**
789  * Constructor from a number (scale factor in y-direction). */
790  ScaleY3D(double y) : Scale3D(1, y, 1) {}
791  };
792 
793  /**
794  * Constructs a scaling transformation in z-direction.
795  * This class provides additional constructors for Transform3D
796  * and should not be used as a separate class.
797  *
798  * Example of use:
799  * @code
800  * Transform3D m;
801  * m = ScaleZ3D(2.);
802  * @endcode
803  *
804  * @author <Evgueni.Tcherniaev@cern.ch>
805  * @ingroup geometry
806  */
807  class ScaleZ3D : public Scale3D {
808  public:
809  /**
810  * Default constructor: sets the Identity transformation. */
811  ScaleZ3D() : Scale3D() {}
812  /**
813  * Constructor from a number (scale factor in z-direction). */
814  ScaleZ3D(double z) : Scale3D(1, 1, z) {}
815  };
816 } /* namespace HepGeom */
817 
818 #include "CLHEP/Geometry/Transform3D.icc"
819 
820 #endif /* HEP_TRANSFROM3D_H */
CLHEP::HepRotation getRotation() const
CLHEP::Hep3Vector getTranslation() const
void setTransform(double XX, double XY, double XZ, double DX, double YX, double YY, double YZ, double DY, double ZX, double ZY, double ZZ, double DZ)
Definition: Transform3D.h:186
Transform3D(double XX, double XY, double XZ, double DX, double YX, double YY, double YZ, double DY, double ZX, double ZY, double ZZ, double DZ)
Definition: Transform3D.h:178
double xy() const
Definition: Transform3D.h:255
RotateY3D(double a)
Definition: Transform3D.h:465
ScaleX3D(double x)
Definition: Transform3D.h:765
double yz() const
Definition: Transform3D.h:267
Transform3D inverse() const
double dx() const
Definition: Transform3D.h:279
Transform3D operator*(const Transform3D &b) const
ScaleZ3D(double z)
Definition: Transform3D.h:814
double zy() const
Definition: Transform3D.h:273
RotateX3D(double a)
Definition: Transform3D.h:437
bool operator!=(const Transform3D &transform) const
Definition: Transform3D.h:353
ReflectY3D(double y=0)
Definition: Transform3D.h:685
bool operator==(const Transform3D &transform) const
double yy() const
Definition: Transform3D.h:264
const XML_Char * s
Definition: expat.h:262
double zz() const
Definition: Transform3D.h:276
double yx() const
Definition: Transform3D.h:261
Double_t scale
Definition: plot.C:25
Transform3D_row(const Transform3D &, int)
Transform3D(const Transform3D &m)
Definition: Transform3D.h:231
Scale3D(double x, double y, double z)
Definition: Transform3D.h:734
Float_t E
Definition: plot.C:20
double xx() const
Definition: Transform3D.h:252
const double a
RotateZ3D(double a)
Definition: Transform3D.h:493
Float_t d
Definition: plot.C:236
static DLL_API const Transform3D Identity
Definition: Transform3D.h:197
#define DLL_API
Definition: defs.h:19
bool isNear(const Transform3D &t, double tolerance=2.2E-14) const
z
Definition: test.py:28
double dz() const
Definition: Transform3D.h:285
double xz() const
Definition: Transform3D.h:258
Transform3D & operator=(const Transform3D &m)
Definition: Transform3D.h:289
Reflect3D(double XX, double XY, double XZ, double DX, double YX, double YY, double YZ, double DY, double ZX, double ZY, double ZZ, double DZ)
Definition: Transform3D.h:624
T sin(T number)
Definition: d0nt_math.hpp:132
ReflectZ3D(double z=0)
Definition: Transform3D.h:706
const hit & b
Definition: hits.cxx:21
Translate3D(double x, double y, double z)
Definition: Transform3D.h:527
double dy() const
Definition: Transform3D.h:282
T cos(T number)
Definition: d0nt_math.hpp:78
void getDecomposition(Scale3D &scale, Rotate3D &rotation, Translate3D &translation) const
double zx() const
Definition: Transform3D.h:270
Scale3D(double s)
Definition: Transform3D.h:739
double operator()(int, int) const
ReflectX3D(double x=0)
Definition: Transform3D.h:664
ScaleY3D(double y)
Definition: Transform3D.h:790