Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4ScaleTransform.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4ScaleTransform
0027 //
0028 // Class description:
0029 //
0030 // A class for geometric scaling transformations.
0031 // Supports efficient arbitrary transformation of points, vectors and
0032 // normals and the computation of compound & inverse transformations.
0033 //
0034 // Interfaces to the CLHEP class G4ThreeVector
0035 //
0036 // For member function descriptions, see comments by declarations. For
0037 // additional clarification, also check the `const' declarations for
0038 // functions & their parameters.
0039 //
0040 // Member data:
0041 //
0042 //    G4ThreeVector fScale;  // scale transformation 
0043 //    G4ThreeVector fIScale; // inverse scale (avoid divisions)
0044 //    G4double flFactor;     // factor for conversion to local frame
0045 //    G4double fgFactor;     // factor for conversion to global frame
0046 
0047 // E.Tcherniaev, 11 Mar 2016 - added transformations for normal
0048 // G.Cosmo,      18 Feb 2016 - initial version
0049 // --------------------------------------------------------------------
0050 #ifndef G4SCALETRANSFORM_HH
0051 #define G4SCALETRANSFORM_HH
0052 
0053 #include "G4Types.hh"
0054 #include "G4ThreeVector.hh"
0055 #include "G4Transform3D.hh"
0056 
0057 class G4ScaleTransform
0058 {
0059 
0060   public:
0061 
0062     inline G4ScaleTransform();
0063       // Default constructor
0064     
0065     inline G4ScaleTransform(G4double sx, G4double sy, G4double sz);
0066       // Constructor with scale parameters on each axis
0067 
0068     inline G4ScaleTransform(const G4ThreeVector& scale);
0069       // Constructor taking a 3-vector
0070 
0071     inline G4ScaleTransform(const G4Scale3D& scale);
0072       // Constructor taking a Scale3D
0073         
0074     inline G4ScaleTransform(const G4ScaleTransform& right);
0075       // Copy constructor
0076 
0077     inline G4ScaleTransform& operator=(const G4ScaleTransform& right);
0078       // Assignment operator
0079 
0080     inline void Init();
0081       // Update the backed-up inverse scale and special conversion factors
0082       // based on the values of the scale. Needed at initialisation and
0083       // whenever the scale has changed value
0084 
0085     inline const G4ThreeVector& GetScale() const;
0086     inline const G4ThreeVector& GetInvScale() const;
0087       // Get reference to the inverse scale transformation
0088  
0089     inline void SetScale(const G4ThreeVector& scale);
0090       // Set scale based on vector
0091     inline void SetScale(const G4Scale3D& scale);
0092       // Set scale based on a G4Scale3D transformation
0093     inline void SetScale(G4double sx, G4double sy, G4double sz);
0094       // Set scale based on values
0095 
0096     inline void Transform(const G4ThreeVector& global,
0097                                 G4ThreeVector& local) const;  
0098     inline G4ThreeVector Transform(const G4ThreeVector& global) const;
0099       // Transform point from global to local frame
0100 
0101     inline void InverseTransform(const G4ThreeVector& local, 
0102                                        G4ThreeVector& global) const;
0103     inline G4ThreeVector InverseTransform(const G4ThreeVector& local) const;
0104       // Transform point from local to global frame
0105 
0106     inline void TransformNormal(const G4ThreeVector& global,
0107                                       G4ThreeVector& local) const;  
0108     inline G4ThreeVector TransformNormal(const G4ThreeVector& global) const;
0109       // Transform normal from global to local frame
0110 
0111     inline void InverseTransformNormal(const G4ThreeVector& local, 
0112                                              G4ThreeVector& global) const;
0113     inline G4ThreeVector InverseTransformNormal(const G4ThreeVector& local) const;
0114       // Transform normal from local to global frame
0115 
0116     inline G4double TransformDistance(G4double dist,
0117                                       const G4ThreeVector& dir) const;
0118       // Transform distance along given direction from global to local frame
0119 
0120     inline G4double TransformDistance(G4double safety) const;
0121       // Transform distance from global to local frame (conservative)
0122 
0123     inline G4double InverseTransformDistance(G4double dist,
0124                                              const G4ThreeVector& dir) const;
0125       // Transform distance along given direction from local to global frame
0126 
0127     inline G4double InverseTransformDistance(G4double safety) const;
0128       // Transform distance from local to global frame (conservative)
0129 
0130   private:
0131 
0132     G4ThreeVector fScale;  // scale transformation 
0133     G4ThreeVector fIScale; // inverse scale (avoid divisions)
0134     G4double flFactor = 1.0, fgFactor = 1.0;
0135       // conversion factors to local/global frames
0136 
0137 }; // End class G4ScaleTransform
0138 
0139 std::ostream& operator<<(std::ostream& os, const G4ScaleTransform& scale);
0140 
0141 #include "G4ScaleTransform.icc"
0142 
0143 #endif // G4SCALETRANSFORM_HH