Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4BoundingExtentScene.cc
Go to the documentation of this file.
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//
28//
29// John Allison 15th February 2019
30// An artificial scene to reuse G4VScene code to calculate a bounding extent.
31
33
34#include "G4VSolid.hh"
36
38:fpModel(pModel)
39{}
40
42
43void G4BoundingExtentScene::ProcessVolume(const G4VSolid& solid)
44{
45 G4VisExtent newExtent = solid.GetExtent ();
48 }
49 AccrueBoundingExtent (newExtent);
50
51 // Curtail descent - can assume daughters are contained within mother...
52 G4PhysicalVolumeModel* pPVM = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
53 if (pPVM) pPVM->CurtailDescent();
54}
55
57{
60}
61
63{
64
65 if (fExtent == G4VisExtent::GetNullExtent()) { // First time.
66
67 fExtent = newExtent;
68
69 } else {
70
71 if (newExtent.GetXmin() < fExtent.GetXmin()) fExtent.SetXmin(newExtent.GetXmin());
72 if (newExtent.GetYmin() < fExtent.GetYmin()) fExtent.SetYmin(newExtent.GetYmin());
73 if (newExtent.GetZmin() < fExtent.GetZmin()) fExtent.SetZmin(newExtent.GetZmin());
74 if (newExtent.GetXmax() > fExtent.GetXmax()) fExtent.SetXmax(newExtent.GetXmax());
75 if (newExtent.GetYmax() > fExtent.GetYmax()) fExtent.SetYmax(newExtent.GetYmax());
76 if (newExtent.GetZmax() > fExtent.GetZmax()) fExtent.SetZmax(newExtent.GetZmax());
77
78 }
79}
void AccrueBoundingExtent(const G4VisExtent &)
G4BoundingExtentScene(G4VModel *pModel=0)
const G4Transform3D * fpCurrentObjectTransformation
virtual G4VisExtent GetExtent() const
Definition: G4VSolid.cc:682
static const G4VisExtent & GetNullExtent()
Definition: G4VisExtent.cc:60
void SetYmin(G4double ymin)
Definition: G4VisExtent.hh:114
G4double GetYmin() const
Definition: G4VisExtent.hh:101
G4double GetXmax() const
Definition: G4VisExtent.hh:100
void SetYmax(G4double ymax)
Definition: G4VisExtent.hh:116
void SetXmax(G4double xmax)
Definition: G4VisExtent.hh:112
G4VisExtent & Transform(const G4Transform3D &)
Definition: G4VisExtent.cc:102
void SetXmin(G4double xmin)
Definition: G4VisExtent.hh:110
void SetZmax(G4double zmax)
Definition: G4VisExtent.hh:120
G4double GetYmax() const
Definition: G4VisExtent.hh:102
G4double GetZmax() const
Definition: G4VisExtent.hh:104
G4double GetZmin() const
Definition: G4VisExtent.hh:103
G4double GetXmin() const
Definition: G4VisExtent.hh:99
void SetZmin(G4double zmin)
Definition: G4VisExtent.hh:118