Geant4 11.4.0
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(), operator!=(), operator<<, operator==(), Transform(), and ~G4VisExtent().

◆ 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(), GetExtentCenter(), G4VisCommandsTouchable::SetNewValue(), and G4VisCommandViewerCentreOn::SetNewValue().

◆ GetExtentRadius()

G4double G4VisExtent::GetExtentRadius ( ) const

◆ 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 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 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 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 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 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 G4VSolid::GetExtent().

◆ Transform()

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

Definition at line 102 of file G4VisExtent.cc.

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

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

◆ 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: