Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4VisExtent.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4VisExtent.cc 102801 2017-02-22 15:17:53Z gcosmo $
28 //
29 //
30 // A.Walkden 28/11/95
31 // G4VisExtent.cc - to return parameters useful to the drawing window
32 // employed by Visualization code.
33 
34 #include "G4VisExtent.hh"
35 
36 #include "G4ios.hh"
37 
40  G4double zmin, G4double zmax):
41  fXmin(xmin), fXmax(xmax), fYmin(ymin), fYmax(ymax), fZmin(zmin), fZmax(zmax),
42  fRadiusCached(false), fCentreCached(false), fRadius(0.)
43 {}
44 
46  fRadiusCached(true), fCentreCached(true),
47  fRadius(radius), fCentre(centre)
48 {
49  // Use exscribed radius ... see comments in header file.
50  G4double halfSide (radius / std::sqrt (3.));
51  fXmin = centre.x () - halfSide;
52  fXmax = centre.x () + halfSide;
53  fYmin = centre.y () - halfSide;
54  fYmax = centre.y () + halfSide;
55  fZmin = centre.z () - halfSide;
56  fZmax = centre.z () + halfSide;
57 }
58 
60 
62  if (!fCentreCached) {
63  fCentre = G4Point3D (((fXmin + fXmax) / 2.),
64  ((fYmin + fYmax) / 2.),
65  ((fZmin + fZmax) / 2.));
66  fCentreCached = true;
67  }
68  return fCentre;
69 }
70 
72  if (!fRadiusCached) {
73  fRadius = std::sqrt (((fXmax - fXmin) * (fXmax - fXmin)) +
74  ((fYmax - fYmin) * (fYmax - fYmin)) +
75  ((fZmax - fZmin) * (fZmax - fZmin))) / 2.;
76  fRadiusCached = true;
77  }
78  return fRadius;
79 }
80 
81 std::ostream& operator << (std::ostream& os, const G4VisExtent& e) {
82  os << "G4VisExtent (bounding box):";
83  os << "\n X limits: " << e.fXmin << ' ' << e.fXmax;
84  os << "\n Y limits: " << e.fYmin << ' ' << e.fYmax;
85  os << "\n Z limits: " << e.fZmin << ' ' << e.fZmax;
86  return os;
87 }
88 
90  return ((fXmin != e.fXmin) ||
91  (fXmax != e.fXmax) ||
92  (fYmin != e.fYmin) ||
93  (fYmax != e.fYmax) ||
94  (fZmin != e.fZmin) ||
95  (fZmax != e.fZmax));
96 }
G4double fZmin
Definition: G4VisExtent.hh:82
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
G4Point3D fCentre
Definition: G4VisExtent.hh:85
G4double fZmax
Definition: G4VisExtent.hh:82
G4double fXmax
Definition: G4VisExtent.hh:82
G4bool fCentreCached
Definition: G4VisExtent.hh:83
const G4Point3D & GetExtentCentre() const
Definition: G4VisExtent.cc:61
G4double fYmax
Definition: G4VisExtent.hh:82
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double fXmin
Definition: G4VisExtent.hh:82
Double_t radius
G4double fRadius
Definition: G4VisExtent.hh:84
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:71
G4double fYmin
Definition: G4VisExtent.hh:82
G4bool fRadiusCached
Definition: G4VisExtent.hh:83
G4bool operator!=(const G4VisExtent &e) const
Definition: G4VisExtent.cc:89
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4VisExtent(G4double xmin=0., G4double xmax=0., G4double ymin=0., G4double ymax=0., G4double zmin=0., G4double zmax=0.)
Definition: G4VisExtent.cc:38