Geant4-11
Public Member Functions | Static Public Member Functions | Private Attributes | Friends
G4VisExtent Class Reference

#include <G4VisExtent.hh>

Public Member Functions

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

Static Public Member Functions

static const G4VisExtentGetNullExtent ()
 

Private Attributes

G4Point3D fCentre
 
G4bool fCentreCached
 
G4double fRadius
 
G4bool fRadiusCached
 
G4double fXmax
 
G4double fXmin
 
G4double fYmax
 
G4double fYmin
 
G4double fZmax
 
G4double fZmin
 

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{}
G4bool fCentreCached
Definition: G4VisExtent.hh:94
G4bool fRadiusCached
Definition: G4VisExtent.hh:94
G4double fXmax
Definition: G4VisExtent.hh:93
G4double fZmax
Definition: G4VisExtent.hh:93
G4double fZmin
Definition: G4VisExtent.hh:93
G4double fXmin
Definition: G4VisExtent.hh:93
G4double fYmin
Definition: G4VisExtent.hh:93
G4double fRadius
Definition: G4VisExtent.hh:95
G4double fYmax
Definition: G4VisExtent.hh:93

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
G4Point3D fCentre
Definition: G4VisExtent.hh:96

References fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ ~G4VisExtent()

G4VisExtent::~G4VisExtent ( )

Definition at line 58 of file G4VisExtent.cc.

58{}

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
Definition: G4VisExtent.cc:65

References GetExtentCentre().

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

References fCentre, fCentreCached, fXmax, fXmin, fYmax, fYmin, fZmax, and fZmin.

Referenced by G4Scene::CalculateExtent(), G4VSceneHandler::CreateSectionSolid(), GetExtentCenter(), G4BoundingSphereScene::ProcessVolume(), 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}

References fRadius, fRadiusCached, fXmax, fXmin, fYmax, fYmin, fZmax, and fZmin.

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

◆ 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.)
Definition: G4VisExtent.cc:37

References G4VisExtent().

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

◆ GetXmax()

G4double G4VisExtent::GetXmax ( ) const
inline

◆ GetXmin()

G4double G4VisExtent::GetXmin ( ) const
inline

◆ GetYmax()

G4double G4VisExtent::GetYmax ( ) const
inline

◆ GetYmin()

G4double G4VisExtent::GetYmin ( ) const
inline

◆ GetZmax()

G4double G4VisExtent::GetZmax ( ) const
inline

◆ GetZmin()

G4double G4VisExtent::GetZmin ( ) const
inline

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

References fXmax, fXmin, fYmax, fYmin, fZmax, and fZmin.

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
Definition: G4VisExtent.cc:93

References operator!=().

◆ SetXmax()

void G4VisExtent::SetXmax ( G4double  xmax)
inline

Definition at line 112 of file G4VisExtent.hh.

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

References fCentreCached, fRadiusCached, and fXmax.

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;}

References fCentreCached, fRadiusCached, and fXmin.

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;}

References fCentreCached, fRadiusCached, and fYmax.

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;}

References fCentreCached, fRadiusCached, and fYmin.

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;}

References fCentreCached, fRadiusCached, and fZmax.

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;}

References fCentreCached, fRadiusCached, and fZmin.

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

◆ Transform()

G4VisExtent & G4VisExtent::Transform ( const G4Transform3D transform)

Definition at line 102 of file G4VisExtent.cc.

103{
104 auto rotation = transform.getRotation();
105 auto translation = transform.getTranslation();
106
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}
G4bool transform(G4String &input, const G4String &type)
#define DBL_MAX
Definition: templates.hh:62

References DBL_MAX, fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, CLHEP::Hep3Vector::transform(), and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

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

Friends And Related Function 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}

Field Documentation

◆ fCentre

G4Point3D G4VisExtent::fCentre
mutableprivate

Definition at line 96 of file G4VisExtent.hh.

Referenced by GetExtentCentre().

◆ fCentreCached

G4bool G4VisExtent::fCentreCached
private

Definition at line 94 of file G4VisExtent.hh.

Referenced by GetExtentCentre(), SetXmax(), SetXmin(), SetYmax(), SetYmin(), SetZmax(), and SetZmin().

◆ fRadius

G4double G4VisExtent::fRadius
mutableprivate

Definition at line 95 of file G4VisExtent.hh.

Referenced by GetExtentRadius().

◆ fRadiusCached

G4bool G4VisExtent::fRadiusCached
mutableprivate

Definition at line 94 of file G4VisExtent.hh.

Referenced by GetExtentRadius(), SetXmax(), SetXmin(), SetYmax(), SetYmin(), SetZmax(), and SetZmin().

◆ fXmax

G4double G4VisExtent::fXmax
private

◆ fXmin

G4double G4VisExtent::fXmin
private

◆ fYmax

G4double G4VisExtent::fYmax
private

◆ fYmin

G4double G4VisExtent::fYmin
private

◆ fZmax

G4double G4VisExtent::fZmax
private

◆ fZmin

G4double G4VisExtent::fZmin
private

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