![]() |
|
|||
Warning, file /geant4/examples/advanced/dna/moleculardna/src/BoxChromosome.cc 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 // 0027 /// file: BoxChromosome.cc 0028 /// brief: Implementation of virt chromosome class for Box chromosomes 0029 0030 #include "BoxChromosome.hh" 0031 0032 #include "G4RandomDirection.hh" 0033 #include "Randomize.hh" 0034 0035 #include <utility> 0036 0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0038 0039 const G4String BoxChromosome::fShape = "box"; 0040 0041 BoxChromosome::BoxChromosome(const G4String& name, G4ThreeVector pos, const G4double& xdim, 0042 const G4double& ydim, const G4double& zdim) 0043 : VirtualChromosome(name), 0044 fCenter(std::move(pos)), 0045 fXdim(xdim), 0046 fYdim(ydim), 0047 fZdim(zdim), 0048 fRotation(G4RotationMatrix()) 0049 { 0050 fInverseRotation = fRotation.inverse(); 0051 } 0052 0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0054 0055 BoxChromosome::BoxChromosome(const G4String& name, G4ThreeVector pos, const G4double& xdim, 0056 const G4double& ydim, const G4double& zdim, G4RotationMatrix rot) 0057 : VirtualChromosome(name), 0058 fCenter(std::move(pos)), 0059 fXdim(xdim), 0060 fYdim(ydim), 0061 fZdim(zdim), 0062 fRotation(std::move(rot)) 0063 {} 0064 0065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0066 0067 BoxChromosome::~BoxChromosome() = default; 0068 0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0070 0071 G4bool BoxChromosome::PointInChromosome(G4ThreeVector const& pos) 0072 { 0073 G4ThreeVector rpos = pos - fCenter; 0074 rpos = fInverseRotation(rpos); 0075 G4bool ok = (std::abs(rpos.getX()) <= fXdim); 0076 ok = ok && (std::abs(rpos.getY()) <= fYdim); 0077 ok = ok && (std::abs(rpos.getZ()) <= fZdim); 0078 return ok; 0079 } 0080 0081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0082 0083 G4ThreeVector BoxChromosome::RandomPointInChromosome() 0084 { 0085 G4ThreeVector point = G4UniformRand() * G4RandomDirection(); 0086 point.setX(point.getX() * fXdim); 0087 point.setY(point.getY() * fYdim); 0088 point.setZ(point.getZ() * fZdim); 0089 return fRotation(point) + fCenter; 0090 } 0091 0092 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |