Import Geant4 10.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2016-06-30 14:12:05 +02:00
parent a654a7ab1f
commit 4ec577e5c4
2021 changed files with 100995 additions and 78277 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4AffineTransform.hh 93152 2015-10-08 11:53:57Z gcosmo $
// $Id: G4AffineTransform.hh 96126 2016-03-16 21:16:54Z gcosmo $
//
//
// class G4AffineTransform
@@ -71,93 +71,94 @@ class G4AffineTransform
public:
G4AffineTransform();
inline G4AffineTransform();
public: // with description
G4AffineTransform(const G4ThreeVector& tlate);
inline G4AffineTransform(const G4ThreeVector& tlate);
// Translation only: under t'form translate point at origin by tlate
G4AffineTransform(const G4RotationMatrix& rot);
inline G4AffineTransform(const G4RotationMatrix& rot);
// Rotation only: under t'form rotate by rot
G4AffineTransform(const G4RotationMatrix& rot,
const G4ThreeVector& tlate);
inline G4AffineTransform(const G4RotationMatrix& rot,
const G4ThreeVector& tlate);
// Under t'form: rotate by rot then translate by tlate
G4AffineTransform(const G4RotationMatrix* rot,
const G4ThreeVector& tlate);
inline G4AffineTransform(const G4RotationMatrix* rot,
const G4ThreeVector& tlate);
// Optionally rotate by *rot then translate by tlate - rot may be null
G4AffineTransform operator * (const G4AffineTransform& tf) const;
inline G4AffineTransform operator * (const G4AffineTransform& tf) const;
// Compound Transforms:
// tf2=tf2*tf1 equivalent to tf2*=tf1
// Returns compound transformation of self*tf
G4AffineTransform& operator *= (const G4AffineTransform& tf);
inline G4AffineTransform& operator *= (const G4AffineTransform& tf);
// (Modifying) Multiplies self by tf; Returns self reference
// ie. A=AB for a*=b
G4AffineTransform& Product(const G4AffineTransform& tf1,
const G4AffineTransform& tf2);
inline G4AffineTransform& Product(const G4AffineTransform& tf1,
const G4AffineTransform& tf2);
// 'Products' for avoiding (potential) temporaries:
// c.Product(a,b) equivalent to c=a*b
// c.InverseProduct(a*b,b ) equivalent to c=a
// (Modifying) Sets self=tf1*tf2; Returns self reference
G4AffineTransform& InverseProduct(const G4AffineTransform& tf1,
const G4AffineTransform& tf2);
inline G4AffineTransform& InverseProduct(const G4AffineTransform& tf1,
const G4AffineTransform& tf2);
// (Modifying) Sets self=tf1*(tf2^-1); Returns self reference
G4ThreeVector TransformPoint(const G4ThreeVector& vec) const;
inline G4ThreeVector TransformPoint(const G4ThreeVector& vec) const;
// Transform the specified point: returns vec*rot+tlate
G4ThreeVector TransformAxis(const G4ThreeVector& axis) const;
inline G4ThreeVector TransformAxis(const G4ThreeVector& axis) const;
// Transform the specified axis: returns
void ApplyPointTransform(G4ThreeVector& vec) const;
inline void ApplyPointTransform(G4ThreeVector& vec) const;
// Transform the specified point (in place): sets vec=vec*rot+tlate
void ApplyAxisTransform(G4ThreeVector& axis) const;
inline void ApplyAxisTransform(G4ThreeVector& axis) const;
// Transform the specified axis (in place): sets axis=axis*rot;
G4AffineTransform Inverse() const;
inline G4AffineTransform Inverse() const;
// Return inverse of current transform
G4AffineTransform& Invert();
inline G4AffineTransform& Invert();
// (Modifying) Sets self=inverse of self; Returns self reference
G4AffineTransform& operator +=(const G4ThreeVector& tlate);
G4AffineTransform& operator -=(const G4ThreeVector& tlate);
inline G4AffineTransform& operator +=(const G4ThreeVector& tlate);
inline G4AffineTransform& operator -=(const G4ThreeVector& tlate);
// (Modifying) Adjust net translation by given vector;
// Returns self reference
G4bool operator == (const G4AffineTransform& tf) const;
G4bool operator != (const G4AffineTransform& tf) const;
inline G4bool operator == (const G4AffineTransform& tf) const;
inline G4bool operator != (const G4AffineTransform& tf) const;
G4double operator [] (const G4int n) const;
inline G4double operator [] (const G4int n) const;
G4bool IsRotated() const;
inline G4bool IsRotated() const;
// True if transform includes rotation
G4bool IsTranslated() const;
inline G4bool IsTranslated() const;
// True if transform includes translation
G4RotationMatrix NetRotation() const;
inline G4RotationMatrix NetRotation() const;
G4ThreeVector NetTranslation() const;
inline G4ThreeVector NetTranslation() const;
void SetNetRotation(const G4RotationMatrix& rot);
inline void SetNetRotation(const G4RotationMatrix& rot);
void SetNetTranslation(const G4ThreeVector& tlate);
inline void SetNetTranslation(const G4ThreeVector& tlate);
private:
G4AffineTransform(const G4double prxx,const G4double prxy,const G4double prxz,
const G4double pryx,const G4double pryy,const G4double pryz,
const G4double przx,const G4double przy,const G4double przz,
const G4double ptx, const G4double pty, const G4double ptz);
inline G4AffineTransform(
const G4double prxx, const G4double prxy, const G4double prxz,
const G4double pryx, const G4double pryy, const G4double pryz,
const G4double przx, const G4double przy, const G4double przz,
const G4double ptx, const G4double pty, const G4double ptz);
G4double rxx,rxy,rxz;
G4double ryx,ryy,ryz;
@@ -0,0 +1,181 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// class G4BoundingEnvelope
//
// Class description:
//
// Helper class to facilitate calculation of the extent of a solid
// within the limits defined by the G4VoxelLimits object.
//
// The function CalculateExtent() of a particular solid can create
// a G4BoundingEnvelope object that bounds the solid and then call
// CalculateExtent() of the G4BoundingEnvelope object.
//
// Calculation of the extent by G4BoundingEnvelope takes into account
// special parameter "delta" - width of an imagery layer that envelops
// the object. This value, multiplied by max scale factor, is added
// to the voxel limits during calculation of the extent.
//
// Example of use.
// In case of G4Box, max possible distance of a point to the border
// of the box, where the point is still considered as belonging to
// the surface of the box, is sqrt(0.5)*kCarTolerance (see corner).
// So, it will be safe to set the extension = kCarTolerance.
//
// Alternative solution can be to define G4BoundingEnvelope wide
// enough to include the surface of the solid and set delta = 0.
//
// The class supports the following bouding envelopes:
// - axis aligned bounding box (AABB);
// - bounding prism given by two convex polygonal bases;
// - bounding pyramid given by apex and convex polygonal base;
// - set of bounding prisms, given by a sequence of convex
// polygonal bases;
// History:
//
// 2016.05.25 E.Tcherniaev - initial version
//
// --------------------------------------------------------------------
#ifndef G4BOUNDINGENVELOPE_HH
#define G4BOUNDINGENVELOPE_HH
#include <vector>
#include "geomdefs.hh"
#include "G4ThreeVector.hh"
#include "G4VoxelLimits.hh"
#include "G4Transform3D.hh"
#include "G4Point3D.hh"
#include "G4Plane3D.hh"
typedef std::vector<G4ThreeVector> G4ThreeVectorList;
typedef std::vector<G4Point3D> G4Polygon3D;
typedef std::pair<G4Point3D,G4Point3D> G4Segment3D;
class G4BoundingEnvelope
{
public:
G4BoundingEnvelope(const G4ThreeVector& pMin,
const G4ThreeVector& pMax, G4double delta);
// Constructor from an axis aligned bounding box (AABB)
G4BoundingEnvelope(const G4ThreeVectorList& baseA,
const G4ThreeVectorList& baseB, G4double delta);
// Constructor from a prism given by two bases, the bases
// should have equal number of vertices
G4BoundingEnvelope(const G4ThreeVector& apex,
const G4ThreeVectorList& base, G4double delta);
// Constructor from a pyramid given by apex and base
G4BoundingEnvelope(const std::vector<G4ThreeVectorList*>& polygons,
G4double delta);
// Constructor from a sequence of convex polygons, the polygons
// should have equal numbers of vertices except first and last
// polygons which may consist of a single vertex
G4BoundingEnvelope(const G4BoundingEnvelope& rhs);
// Copy constructor
G4BoundingEnvelope& operator=(const G4BoundingEnvelope& rhs);
// Assignment operator
~G4BoundingEnvelope();
// Destructor
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimits,
const G4Transform3D& pTransform3D,
G4double& pMin, G4double& pMax) const;
// Calculate extent of the envelope
private:
void SetDelta(G4double delta);
// Set the extension
void SetBoundingBox(const G4ThreeVector& pMin,
const G4ThreeVector& pMax);
// Set AABB (axis aligned bounding box)
void SetBoundingPrism(const G4ThreeVectorList& baseA,
const G4ThreeVectorList& baseB);
// Set bounding prism
void SetBoundingPyramid(const G4ThreeVector& apex,
const G4ThreeVectorList& base);
// Set bounding pyramid
void SetBoundingPolygons(const std::vector<G4ThreeVectorList*>& polygons);
// Set bounding sequence of convex polygons
void CleanPolygons();
// Free allocated memory
G4VoxelLimits GetAdjustedVoxelLimits(const G4VoxelLimits& pVoxelLimits,
G4double pDelta) const;
// Extend voxel limits by scaled surface tolerance
void TransformVertices(const G4Transform3D& pTransform3D,
const G4Polygon3D& polyA,
G4Polygon3D& polyB,
G4Segment3D& pAABB) const;
// Transform vertices of a polygon and update AABB (bounding box)
void CreateListOfEdges(const G4Polygon3D& baseA,
const G4Polygon3D& baseB,
std::vector<G4Segment3D>& pEdges) const;
// Create list of edges of a prism
void CreateListOfPlanes(const G4Polygon3D& baseA,
const G4Polygon3D& baseB,
std::vector<G4Plane3D>& pPlanes) const;
// Create list of planes bounding a prism
G4bool ClipEdgesByVoxelLimits(const std::vector<G4Segment3D>& pEdges,
const G4VoxelLimits& pLimits,
G4Segment3D& pExtent) const;
// Clip set of edges by G4VoxelLimits
void ClipVoxelLimitsByPlanes(const G4VoxelLimits& pLimits,
const std::vector<G4Plane3D>& pPlanes,
const G4Segment3D& pAABB,
G4Segment3D& pExtent) const;
// Clip G4VoxelLimits by set of planes bounding a convex prism
private:
G4double fDelta; // extention
std::vector<G4Polygon3D*> fBases; // sequence of polygonal bases
};
#endif // G4BOUNDINGENVELOPE_HH
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ReflectedSolid.hh 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4ReflectedSolid.hh 96930 2016-05-18 08:56:58Z gcosmo $
//
//
// class G4ReflectedSolid
@@ -37,16 +37,13 @@
// History:
//
// 23.07.01 V.Grichine: created
// 15.02.02 V.Grichine: get/set methods for fPtr(Direct)Transform3D
// --------------------------------------------------------------------
#ifndef G4ReflectedSolid_HH
#define G4ReflectedSolid_HH
#include "G4VSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4AffineTransform.hh"
class G4ReflectedSolid : public G4VSolid
{
@@ -54,10 +51,10 @@ class G4ReflectedSolid : public G4VSolid
G4ReflectedSolid( const G4String& pName,
G4VSolid* pSolid ,
const G4Transform3D& transform ) ;
const G4Transform3D& transform ) ;
// For use in instantiating a transient instance.
virtual ~G4ReflectedSolid() ;
virtual ~G4ReflectedSolid();
// Virtual destructor.
public: // without description
@@ -74,7 +71,7 @@ class G4ReflectedSolid : public G4VSolid
G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
G4double DistanceToIn( const G4ThreeVector& p,
const G4ThreeVector& v ) const;
const G4ThreeVector& v ) const;
G4double DistanceToIn( const G4ThreeVector& p) const;
@@ -82,9 +79,9 @@ class G4ReflectedSolid : public G4VSolid
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0 ) const;
G4ThreeVector *n=0 ) const;
G4double DistanceToOut( const G4ThreeVector& p ) const ;
G4double DistanceToOut( const G4ThreeVector& p ) const;
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
@@ -103,12 +100,11 @@ class G4ReflectedSolid : public G4VSolid
// If the Solid is a "G4ReflectedSolid",
// return a self pointer else return 0.
G4VSolid* GetConstituentMovedSolid() const;
G4VSolid* GetConstituentMovedSolid() const;
G4Transform3D GetTransform3D() const;
void SetTransform3D(G4Transform3D&);
G4Transform3D GetDirectTransform3D() const;
void SetDirectTransform3D(G4Transform3D&);
G4Transform3D GetTransform3D() const;
G4Transform3D GetDirectTransform3D() const;
void SetDirectTransform3D(G4Transform3D&);
// Accessors methods.
std::ostream& StreamInfo(std::ostream& os) const;
@@ -119,39 +115,18 @@ class G4ReflectedSolid : public G4VSolid
G4ReflectedSolid& operator=(const G4ReflectedSolid& rhs);
// Copy constructor and assignment operator.
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4Polyhedron* CreatePolyhedron () const ;
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
G4Polyhedron* CreatePolyhedron () const;
G4Polyhedron* GetPolyhedron () const;
// For creating graphical representations (ie for visualisation).
// For creating graphical representations (i.e. for visualisation).
protected:
G4AffineTransform GetTransform() const;
void SetTransform(G4AffineTransform&);
G4AffineTransform GetDirectTransform() const;
void SetDirectTransform(G4AffineTransform&);
G4RotationMatrix GetFrameRotation() const;
void SetFrameRotation(const G4RotationMatrix&);
G4ThreeVector GetFrameTranslation() const;
void SetFrameTranslation(const G4ThreeVector&);
// Get/Set the rotation/translation, as applied to the
// frame of reference.
G4RotationMatrix GetObjectRotation() const;
void SetObjectRotation(const G4RotationMatrix&);
G4ThreeVector GetObjectTranslation() const;
void SetObjectTranslation(const G4ThreeVector&);
// Get/Set the rotation/translation, as applied to the object.
G4VSolid* fPtrSolid ;
G4AffineTransform* fPtrTransform ;
G4AffineTransform* fDirectTransform ;
G4Transform3D* fPtrTransform3D ;
G4Transform3D* fDirectTransform3D ;
G4VSolid* fPtrSolid;
G4Transform3D* fDirectTransform3D;
mutable G4bool fRebuildPolyhedron;
mutable G4Polyhedron* fpPolyhedron; // Caches reflected G4Polyhedron.
} ;
};
#endif
@@ -0,0 +1,148 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// class G4ScaleTransform
//
// Class description:
//
// A class for geometric scaling transformations.
// Supports efficient arbitrary transformation of points, vectors and
// normals and the computation of compound & inverse transformations.
//
// Interfaces to the CLHEP class G4ThreeVector
//
// For member function descriptions, see comments by declarations. For
// additional clarification, also check the `const' declarations for
// functions & their parameters.
//
// Member data:
//
// G4ThreeVector fScale; // scale transformation
// G4ThreeVector fIScale; // inverse scale (avoid divisions)
// G4double flFactor; // factor for conversion to local frame
// G4double fgFactor; // factor for conversion to global frame
// History:
// E.Tcherniaev 11 Mar 2016 - added transformations for normal
// G.Cosmo 18 Feb 2016 - initial version
//
// --------------------------------------------------------------------
#ifndef G4SCALETRANSFORM_HH
#define G4SCALETRANSFORM_HH
#include "G4Types.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
class G4ScaleTransform
{
public:
inline G4ScaleTransform();
// Default constructor
inline G4ScaleTransform(G4double sx, G4double sy, G4double sz);
// Constructor with scale parameters on each axis
inline G4ScaleTransform(const G4ThreeVector& scale);
// Constructor taking a 3-vector
inline G4ScaleTransform(const G4Scale3D& scale);
// Constructor taking a Scale3D
inline G4ScaleTransform(const G4ScaleTransform& right);
// Copy constructor
inline G4ScaleTransform& operator=(const G4ScaleTransform& right);
// Assignment operator
inline void Init();
// Update the backed-up inverse scale and special conversion factors
// based on the values of the scale. Needed at initialisation and
// whenever the scale has changed value
inline const G4ThreeVector& GetScale() const;
inline const G4ThreeVector& GetInvScale() const;
// Get reference to the inverse scale transformation
inline void SetScale(const G4ThreeVector& scale);
// Set scale based on vector
inline void SetScale(const G4Scale3D& scale);
// Set scale based on a G4Scale3D transformation
inline void SetScale(G4double sx, G4double sy, G4double sz);
// Set scale based on values
inline void Transform(const G4ThreeVector& global,
G4ThreeVector& local) const;
inline G4ThreeVector Transform(const G4ThreeVector& global) const;
// Transform point from global to local frame
inline void InverseTransform(const G4ThreeVector& local,
G4ThreeVector& global) const;
inline G4ThreeVector InverseTransform(const G4ThreeVector& local) const;
// Transform point from local to global frame
inline void TransformNormal(const G4ThreeVector& global,
G4ThreeVector& local) const;
inline G4ThreeVector TransformNormal(const G4ThreeVector& global) const;
// Transform normal from global to local frame
inline void InverseTransformNormal(const G4ThreeVector& local,
G4ThreeVector& global) const;
inline G4ThreeVector InverseTransformNormal(const G4ThreeVector& local) const;
// Transform normal from local to global frame
inline G4double TransformDistance(G4double dist,
const G4ThreeVector& dir) const;
// Transform distance along given direction from global to local frame
inline G4double TransformDistance(G4double safety) const;
// Transform distance from global to local frame (conservative)
inline G4double InverseTransformDistance(G4double dist,
const G4ThreeVector& dir) const;
// Transform distance along given direction from local to global frame
inline G4double InverseTransformDistance(G4double safety) const;
// Transform distance from local to global frame (conservative)
private:
G4ThreeVector fScale; // scale transformation
G4ThreeVector fIScale; // inverse scale (avoid divisions)
G4double flFactor, fgFactor; // conversion factors to local/global frames
}; // End class G4ScaleTransform
std::ostream& operator<<(std::ostream& os, const G4ScaleTransform& scale);
#include "G4ScaleTransform.icc"
#endif // G4SCALETRANSFORM_HH
@@ -0,0 +1,237 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: $
//
//
// G4ScaleTransform Inline implementation.
// Based on implementation provided in Root
//
// --------------------------------------------------------------------
inline G4ScaleTransform::G4ScaleTransform()
: fScale(1.,1.,1.), fIScale(1.,1.,1.), flFactor(1.), fgFactor(1.)
{
}
inline G4ScaleTransform::G4ScaleTransform(G4double sx, G4double sy, G4double sz)
: fScale(sx,sy,sz), fIScale(), flFactor(1.), fgFactor(1.)
{
Init();
}
inline G4ScaleTransform::G4ScaleTransform(const G4ThreeVector& scale)
: fScale(scale), fIScale(), flFactor(1.), fgFactor(1.)
{
Init();
}
inline G4ScaleTransform::G4ScaleTransform(const G4Scale3D& scale)
: fScale(scale.xx(), scale.yy(), scale.zz()), fIScale(),
flFactor(1.), fgFactor(1.)
{
Init();
}
inline G4ScaleTransform::G4ScaleTransform(const G4ScaleTransform& right)
: fScale(right.fScale), fIScale(right.fIScale),
flFactor(right.flFactor), fgFactor(right.fgFactor)
{
}
inline G4ScaleTransform&
G4ScaleTransform::operator=(const G4ScaleTransform& right)
{
fScale = right.fScale;
fIScale = right.fIScale;
flFactor = right.flFactor;
fgFactor = right.fgFactor;
return *this;
}
inline void G4ScaleTransform::Init()
{
if (!((fScale.x()>0) && (fScale.y()>0) && (fScale.z()>0)))
{
G4Exception("G4ScaleTransform::Init()", "GeomMgt0001",
FatalException, "Scale transformation must be positive!");
}
fIScale.set(1./fScale.x(), 1./fScale.y(), 1./fScale.z());
flFactor = std::min(std::min(fIScale.x(), fIScale.y()), fIScale.z());
fgFactor = std::min(std::min(fScale.x(), fScale.y()), fScale.z());
}
inline const G4ThreeVector& G4ScaleTransform::GetScale() const
{
return fScale;
}
inline const G4ThreeVector& G4ScaleTransform::GetInvScale() const
{
return fIScale;
}
inline void G4ScaleTransform::SetScale(const G4ThreeVector& scale)
{
fScale = scale;
Init();
}
inline void G4ScaleTransform::SetScale(const G4Scale3D& scale)
{
fScale.set(scale.xx(), scale.yy(), scale.zz());
Init();
}
inline void G4ScaleTransform::SetScale(G4double sx, G4double sy, G4double sz)
{
fScale.set(sx,sy,sz);
Init();
}
inline void G4ScaleTransform::Transform(const G4ThreeVector& global,
G4ThreeVector& local) const
{
local.set(global.x()*fIScale.x(),
global.y()*fIScale.y(),
global.z()*fIScale.z());
}
inline G4ThreeVector
G4ScaleTransform::Transform(const G4ThreeVector& global) const
{
G4ThreeVector local(global.x()*fIScale.x(),
global.y()*fIScale.y(),
global.z()*fIScale.z());
return local;
}
inline void
G4ScaleTransform::InverseTransform(const G4ThreeVector& local,
G4ThreeVector& global) const
{
global.set(local.x()*fScale.x(),
local.y()*fScale.y(),
local.z()*fScale.z());
}
inline G4ThreeVector
G4ScaleTransform::InverseTransform(const G4ThreeVector& local) const
{
G4ThreeVector global(local.x()*fScale.x(),
local.y()*fScale.y(),
local.z()*fScale.z());
return global;
}
inline void
G4ScaleTransform::TransformNormal(const G4ThreeVector& global,
G4ThreeVector& local) const
{
local.set(global.x()*fIScale.y()*fIScale.z(),
global.y()*fIScale.z()*fIScale.x(),
global.z()*fIScale.x()*fIScale.y());
}
inline G4ThreeVector
G4ScaleTransform::TransformNormal(const G4ThreeVector& global) const
{
G4ThreeVector local(global.x()*fIScale.y()*fIScale.z(),
global.y()*fIScale.z()*fIScale.x(),
global.z()*fIScale.x()*fIScale.y());
return local;
}
inline void
G4ScaleTransform::InverseTransformNormal(const G4ThreeVector& local,
G4ThreeVector& global) const
{
global.set(local.x()*fScale.y()*fScale.z(),
local.y()*fScale.z()*fScale.x(),
local.z()*fScale.x()*fScale.y());
}
inline G4ThreeVector
G4ScaleTransform::InverseTransformNormal(const G4ThreeVector& local) const
{
G4ThreeVector global(local.x()*fScale.y()*fScale.z(),
local.y()*fScale.z()*fScale.x(),
local.z()*fScale.x()*fScale.y());
return global;
}
inline G4double
G4ScaleTransform::TransformDistance(G4double dist,
const G4ThreeVector& dir) const
{
G4ThreeVector v(dir.x()*fIScale.x(),
dir.y()*fIScale.y(),
dir.z()*fIScale.z());
G4double scale = std::sqrt(v.dot(v));
return ( scale*dist );
}
inline G4double G4ScaleTransform::TransformDistance(G4double safety) const
{
return ( safety*flFactor );
}
inline G4double
G4ScaleTransform::InverseTransformDistance(G4double dist,
const G4ThreeVector& dir) const
{
G4ThreeVector v(dir.x()*fScale.x(),
dir.y()*fScale.y(),
dir.z()*fScale.z());
G4double scale = std::sqrt(v.dot(v));
return ( scale*dist );
}
inline G4double
G4ScaleTransform::InverseTransformDistance(G4double safety) const
{
return ( safety*fgFactor );
}
inline
std::ostream& operator << (std::ostream& os, const G4ScaleTransform& transf)
{
std::streamsize oldPrec = os.precision(6);
os << " Scale Transformation: " << G4endl
<< " x,y,z: "
<< transf.GetScale().x() << " "
<< transf.GetScale().y() << " "
<< transf.GetScale().z() << G4endl
<< " Inverse x,y,z: "
<< transf.GetInvScale().x() << " "
<< transf.GetInvScale().y() << " "
<< transf.GetInvScale().z() << G4endl;
os.precision(oldPrec);
return os;
}
@@ -40,7 +40,7 @@
#include "G4VSolid.hh"
#if defined(G4GEOM_USE_USOLIDS)
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "VUSolid.hh"
@@ -154,7 +154,7 @@ class G4USolid : public G4VSolid
virtual G4VisExtent GetExtent() const;
// Provide extent (bounding box) as possible hint to the graphics view.
G4Polyhedron* CreatePolyhedron() const;
virtual G4Polyhedron* CreatePolyhedron() const;
// Create Polyhedron used for Visualisation
virtual G4Polyhedron* GetPolyhedron() const;
// Smart access function - creates on request and stores for future