125 lines
5.0 KiB
Plaintext
125 lines
5.0 KiB
Plaintext
//
|
|
// ********************************************************************
|
|
// * 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. *
|
|
// ********************************************************************
|
|
//
|
|
// Class G4MultiUnion inline implementation.
|
|
|
|
// Author: Marek Gayer (CERN), 19.10.2012 - Original implementation from USolids
|
|
// Gabriele Cosmo (CERN) 06.04.2017 - Adapted implementation in Geant4
|
|
// for VecGeom migration
|
|
// --------------------------------------------------------------------
|
|
|
|
inline G4Voxelizer& G4MultiUnion::GetVoxels() const
|
|
{
|
|
return (G4Voxelizer&)fVoxels;
|
|
}
|
|
|
|
inline const G4Transform3D& G4MultiUnion::GetTransformation(G4int index) const
|
|
{
|
|
return fTransformObjs[index];
|
|
}
|
|
|
|
inline G4VSolid* G4MultiUnion::GetSolid(G4int index) const
|
|
{
|
|
return fSolids[index];
|
|
}
|
|
|
|
inline G4int G4MultiUnion::GetNumberOfSolids() const
|
|
{
|
|
return G4int(fSolids.size());
|
|
}
|
|
|
|
inline void G4MultiUnion::SetAccurateSafety(G4bool flag)
|
|
{
|
|
fAccurate = flag;
|
|
}
|
|
|
|
inline
|
|
G4ThreeVector G4MultiUnion::GetLocalPoint(const G4Transform3D& trans,
|
|
const G4ThreeVector& global) const
|
|
{
|
|
// Returns local point coordinates converted from the global frame defined
|
|
// by the transformation. This is defined by multiplying the inverse
|
|
// transformation with the global vector.
|
|
|
|
G4double px = global.x() - trans.dx();
|
|
G4double py = global.y() - trans.dy();
|
|
G4double pz = global.z() - trans.dz();
|
|
G4double x = trans.xx()*px + trans.yx()*py + trans.zx()*pz;
|
|
G4double y = trans.xy()*px + trans.yy()*py + trans.zy()*pz;
|
|
G4double z = trans.xz()*px + trans.yz()*py + trans.zz()*pz;
|
|
return { x, y, z };
|
|
}
|
|
|
|
inline
|
|
G4ThreeVector G4MultiUnion::GetLocalVector(const G4Transform3D& trans,
|
|
const G4ThreeVector& global) const
|
|
{
|
|
// Returns local point coordinates converted from the global frame defined
|
|
// by the transformation. This is defined by multiplying the inverse
|
|
// transformation with the global vector.
|
|
|
|
G4double vx = global.x();
|
|
G4double vy = global.y();
|
|
G4double vz = global.z();
|
|
G4double x = trans.xx()*vx + trans.yx()*vy + trans.zx()*vz;
|
|
G4double y = trans.xy()*vx + trans.yy()*vy + trans.zy()*vz;
|
|
G4double z = trans.xz()*vx + trans.yz()*vy + trans.zz()*vz;
|
|
return { x, y, z };
|
|
}
|
|
|
|
inline
|
|
G4ThreeVector G4MultiUnion::GetGlobalPoint(const G4Transform3D& trans,
|
|
const G4ThreeVector& local) const
|
|
{
|
|
// Returns global point coordinates converted from the local frame defined
|
|
// by the transformation. This is defined by multiplying this transformation
|
|
// with the local vector.
|
|
|
|
G4double px = local.x();
|
|
G4double py = local.y();
|
|
G4double pz = local.z();
|
|
G4double x = trans.xx()*px + trans.xy()*py + trans.xz()*pz + trans.dx();
|
|
G4double y = trans.yx()*px + trans.yy()*py + trans.yz()*pz + trans.dy();
|
|
G4double z = trans.zx()*px + trans.zy()*py + trans.zz()*pz + trans.dz();
|
|
return { x, y, z };
|
|
}
|
|
|
|
inline
|
|
G4ThreeVector G4MultiUnion::GetGlobalVector(const G4Transform3D& trans,
|
|
const G4ThreeVector& local) const
|
|
{
|
|
// Returns vector components converted from the local frame defined by the
|
|
// transformation to the global one. This is defined by multiplying this
|
|
// transformation with the local vector while ignoring the translation.
|
|
|
|
G4double vx = local.x();
|
|
G4double vy = local.y();
|
|
G4double vz = local.z();
|
|
G4double x = trans.xx()*vx + trans.xy()*vy + trans.xz()*vz;
|
|
G4double y = trans.yx()*vx + trans.yy()*vy + trans.yz()*vz;
|
|
G4double z = trans.zx()*vx + trans.zy()*vy + trans.zz()*vz;
|
|
return { x, y, z };
|
|
}
|