Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisExtent Class Reference

#include <G4VisExtent.hh>

Public Member Functions

 G4VisExtent (G4double xmin=0., G4double xmax=0., G4double ymin=0., G4double ymax=0., G4double zmin=0., G4double zmax=0.)
 
 G4VisExtent (const G4Point3D &centre, G4double radius)
 
 ~G4VisExtent ()
 
G4bool operator!= (const G4VisExtent &e) const
 
G4bool operator== (const G4VisExtent &e) const
 
G4VisExtentTransform (const G4Transform3D &)
 
G4double GetXmin () const
 
G4double GetXmax () const
 
G4double GetYmin () const
 
G4double GetYmax () const
 
G4double GetZmin () const
 
G4double GetZmax () const
 
const G4Point3DGetExtentCentre () const
 
const G4Point3DGetExtentCenter () const
 
G4double GetExtentRadius () const
 
void SetXmin (G4double xmin)
 
void SetXmax (G4double xmax)
 
void SetYmin (G4double ymin)
 
void SetYmax (G4double ymax)
 
void SetZmin (G4double zmin)
 
void SetZmax (G4double zmax)
 

Static Public Member Functions

static const G4VisExtentGetNullExtent ()
 

Friends

std::ostream & operator<< (std::ostream &os, const G4VisExtent &e)
 

Detailed Description

Definition at line 54 of file G4VisExtent.hh.

Constructor & Destructor Documentation

◆ G4VisExtent() [1/2]

G4VisExtent::G4VisExtent ( G4double xmin = 0.,
G4double xmax = 0.,
G4double ymin = 0.,
G4double ymax = 0.,
G4double zmin = 0.,
G4double zmax = 0. )

Definition at line 37 of file G4VisExtent.cc.

39 :
40 fXmin(xmin), fXmax(xmax), fYmin(ymin), fYmax(ymax), fZmin(zmin), fZmax(zmax),
41 fRadiusCached(false), fCentreCached(false), fRadius(0.)
42{}

Referenced by GetNullExtent().

◆ G4VisExtent() [2/2]

G4VisExtent::G4VisExtent ( const G4Point3D & centre,
G4double radius )

Definition at line 44 of file G4VisExtent.cc.

44 :
45 fRadiusCached(true), fCentreCached(true),
46 fRadius(radius), fCentre(centre)
47{
48 // Use exscribed radius ... see comments in header file.
49 G4double halfSide (radius / std::sqrt (3.));
50 fXmin = centre.x () - halfSide;
51 fXmax = centre.x () + halfSide;
52 fYmin = centre.y () - halfSide;
53 fYmax = centre.y () + halfSide;
54 fZmin = centre.z () - halfSide;
55 fZmax = centre.z () + halfSide;
56}
double G4double
Definition G4Types.hh:83

◆ ~G4VisExtent()

G4VisExtent::~G4VisExtent ( )
default

Member Function Documentation

◆ GetExtentCenter()

const G4Point3D & G4VisExtent::GetExtentCenter ( ) const
inline

Definition at line 106 of file G4VisExtent.hh.

106 {
107 return GetExtentCentre ();
108}
const G4Point3D & GetExtentCentre() const

Referenced by G4VVisCommand::DrawExtent().

◆ GetExtentCentre()

const G4Point3D & G4VisExtent::GetExtentCentre ( ) const

Definition at line 65 of file G4VisExtent.cc.

65 {
66 if (!fCentreCached) {
67 fCentre = G4Point3D (((fXmin + fXmax) / 2.),
68 ((fYmin + fYmax) / 2.),
69 ((fZmin + fZmax) / 2.));
70 fCentreCached = true;
71 }
72 return fCentre;
73}
HepGeom::Point3D< G4double > G4Point3D
Definition G4Point3D.hh:34

Referenced by G4Scene::CalculateExtent(), G4VSceneHandler::CreateCutawaySolid(), G4VSceneHandler::CreateSectionSolid(), GetExtentCenter(), G4VisCommandsTouchable::SetNewValue(), and G4VisCommandViewerCentreOn::SetNewValue().

◆ GetExtentRadius()

G4double G4VisExtent::GetExtentRadius ( ) const

Definition at line 75 of file G4VisExtent.cc.

75 {
76 if (!fRadiusCached) {
77 fRadius = std::sqrt (((fXmax - fXmin) * (fXmax - fXmin)) +
78 ((fYmax - fYmin) * (fYmax - fYmin)) +
79 ((fZmax - fZmin) * (fZmax - fZmin))) / 2.;
80 fRadiusCached = true;
81 }
82 return fRadius;
83}

Referenced by G4OpenGLXmViewer::actions_callback(), G4Qt3DSceneHandler::AddPrimitive(), G4Qt3DSceneHandler::AddPrimitive(), G4Qt3DSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4PhysicalVolumeModel::CalculateExtent(), G4Scene::CalculateExtent(), G4VSceneHandler::CreateCutawaySolid(), G4VSceneHandler::CreateSectionSolid(), G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::mouse_move(), G4Qt3DViewer::mouseMoveEvent(), G4VisManager::RegisterEndOfEventUserVisAction(), G4VisManager::RegisterEndOfRunUserVisAction(), G4VisManager::RegisterRunDurationUserVisAction(), G4OpenGLXmViewer::ResetView(), G4DAWNFILEViewer::SendViewParameters(), G4VisCommandSceneAddArrow::SetNewValue(), G4VisCommandSceneAddAxes::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4OpenGLViewer::SetView(), G4OpenInventorViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::wheel_rotate(), and G4Qt3DViewer::wheelEvent().

◆ GetNullExtent()

const G4VisExtent & G4VisExtent::GetNullExtent ( )
static

Definition at line 60 of file G4VisExtent.cc.

60 {
61 static const G4VisExtent nullExtent = G4VisExtent();
62 return nullExtent;
63}
G4VisExtent(G4double xmin=0., G4double xmax=0., G4double ymin=0., G4double ymax=0., G4double zmin=0., G4double zmax=0.)

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), G4Scene::CalculateExtent(), G4VFieldModel::DescribeYourselfTo(), G4VFieldModel::G4VFieldModel(), G4VSceneHandler::ProcessScene(), and G4BoundingExtentScene::ResetBoundingExtent().

◆ GetXmax()

◆ GetXmin()

◆ GetYmax()

◆ GetYmin()

◆ GetZmax()

◆ GetZmin()

◆ operator!=()

G4bool G4VisExtent::operator!= ( const G4VisExtent & e) const

Definition at line 93 of file G4VisExtent.cc.

93 {
94 return ((fXmin != e.fXmin) ||
95 (fXmax != e.fXmax) ||
96 (fYmin != e.fYmin) ||
97 (fYmax != e.fYmax) ||
98 (fZmin != e.fZmin) ||
99 (fZmax != e.fZmax));
100}

Referenced by operator==().

◆ operator==()

G4bool G4VisExtent::operator== ( const G4VisExtent & e) const
inline

Definition at line 65 of file G4VisExtent.hh.

65{return !operator!=(e);}
G4bool operator!=(const G4VisExtent &e) const

◆ SetXmax()

void G4VisExtent::SetXmax ( G4double xmax)
inline

Definition at line 112 of file G4VisExtent.hh.

113{fXmax = xmax; fRadiusCached = false; fCentreCached = false;}

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), and G4VSolid::GetExtent().

◆ SetXmin()

void G4VisExtent::SetXmin ( G4double xmin)
inline

Definition at line 110 of file G4VisExtent.hh.

111{fXmin = xmin; fRadiusCached = false; fCentreCached = false;}

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), and G4VSolid::GetExtent().

◆ SetYmax()

void G4VisExtent::SetYmax ( G4double ymax)
inline

Definition at line 116 of file G4VisExtent.hh.

117{fYmax = ymax; fRadiusCached = false; fCentreCached = false;}

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), and G4VSolid::GetExtent().

◆ SetYmin()

void G4VisExtent::SetYmin ( G4double ymin)
inline

Definition at line 114 of file G4VisExtent.hh.

115{fYmin = ymin; fRadiusCached = false; fCentreCached = false;}

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), and G4VSolid::GetExtent().

◆ SetZmax()

void G4VisExtent::SetZmax ( G4double zmax)
inline

Definition at line 120 of file G4VisExtent.hh.

121{fZmax = zmax; fRadiusCached = false; fCentreCached = false;}

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), and G4VSolid::GetExtent().

◆ SetZmin()

void G4VisExtent::SetZmin ( G4double zmin)
inline

Definition at line 118 of file G4VisExtent.hh.

119{fZmin = zmin; fRadiusCached = false; fCentreCached = false;}

Referenced by G4BoundingExtentScene::AccrueBoundingExtent(), and G4VSolid::GetExtent().

◆ Transform()

G4VisExtent & G4VisExtent::Transform ( const G4Transform3D & transform)

Definition at line 102 of file G4VisExtent.cc.

103{
104 const auto& rotation = transform.getRotation();
105 const auto& translation = transform.getTranslation();
106
107 G4ThreeVector nnn(fXmin,fYmin,fZmin);
108 G4ThreeVector nnx(fXmin,fYmin,fZmax);
109 G4ThreeVector nxn(fXmin,fYmax,fZmin);
110 G4ThreeVector nxx(fXmin,fYmax,fZmax);
111 G4ThreeVector xnn(fXmax,fYmin,fZmin);
112 G4ThreeVector xnx(fXmax,fYmin,fZmax);
113 G4ThreeVector xxn(fXmax,fYmax,fZmin);
114 G4ThreeVector xxx(fXmax,fYmax,fZmax);
115
116 nnn.transform(rotation); nnn += translation;
117 nnx.transform(rotation); nnx += translation;
118 nxn.transform(rotation); nxn += translation;
119 nxx.transform(rotation); nxx += translation;
120 xnn.transform(rotation); xnn += translation;
121 xnx.transform(rotation); xnx += translation;
122 xxn.transform(rotation); xxn += translation;
123 xxx.transform(rotation); xxx += translation;
124
125 fXmin = DBL_MAX;
126 fYmin = DBL_MAX;
127 fZmin = DBL_MAX;
128 fXmax = -DBL_MAX;
129 fYmax = -DBL_MAX;
130 fZmax = -DBL_MAX;
131 for (const auto& corner: {nnn,nnx,nxn,nxx,xnn,xnx,xxn,xxx}) {
132 if (fXmin > corner.getX()) fXmin = corner.getX();
133 if (fYmin > corner.getY()) fYmin = corner.getY();
134 if (fZmin > corner.getZ()) fZmin = corner.getZ();
135 if (fXmax < corner.getX()) fXmax = corner.getX();
136 if (fYmax < corner.getY()) fYmax = corner.getY();
137 if (fZmax < corner.getZ()) fZmax = corner.getZ();
138 }
139
140 return *this;
141}
CLHEP::HepRotation getRotation() const
CLHEP::Hep3Vector getTranslation() const
#define DBL_MAX
Definition templates.hh:62

Referenced by G4PhysicalVolumeModel::CalculateExtent(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSetVolumeForField::SetNewValue(), and G4VisCommandsTouchable::SetNewValue().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4VisExtent & e )
friend

Definition at line 85 of file G4VisExtent.cc.

85 {
86 os << "G4VisExtent (bounding box):";
87 os << "\n X limits: " << e.fXmin << ' ' << e.fXmax;
88 os << "\n Y limits: " << e.fYmin << ' ' << e.fYmax;
89 os << "\n Z limits: " << e.fZmin << ' ' << e.fZmax;
90 return os;
91}

The documentation for this class was generated from the following files: