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

#include <G4RayTracerViewer.hh>

+ Inheritance diagram for G4RayTracerViewer:

Public Member Functions

 G4RayTracerViewer (G4VSceneHandler &, const G4String &name, G4TheRayTracer *=0)
 
virtual ~G4RayTracerViewer ()
 
void Initialise ()
 
void SetView ()
 
void ClearView ()
 
void DrawView ()
 
G4TheRayTracerGetTracer ()
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void Initialise ()
 
virtual void ResetView ()
 
virtual void SetView ()=0
 
virtual void ClearView ()=0
 
virtual void DrawView ()=0
 
void RefreshView ()
 
virtual void ShowView ()
 
virtual void FinishView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
void SetViewParameters (const G4ViewParameters &vp)
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
void SetNeedKernelVisit (G4bool need)
 
void NeedKernelVisit ()
 
void ProcessView ()
 

Protected Attributes

G4int fFileCount
 
G4TheRayTracertheTracer
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4bool fNeedKernelVisit
 

Additional Inherited Members

- Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 

Detailed Description

Definition at line 37 of file G4RayTracerViewer.hh.

Constructor & Destructor Documentation

◆ G4RayTracerViewer()

G4RayTracerViewer::G4RayTracerViewer ( G4VSceneHandler sceneHandler,
const G4String name,
G4TheRayTracer aTracer = 0 
)

Definition at line 41 of file G4RayTracerViewer.cc.

45: G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
46, fFileCount(0)
47, theTracer(aTracer)
48{
49 if (!theTracer) {
50 G4cerr << "G4RayTracerViewer::Initialise: No tracer" << G4endl;
51 fViewId = -1; // This flags an error.
52 return;
53 }
54}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4TheRayTracer * theTracer
G4int IncrementViewCount()
G4int fViewId
Definition: G4VViewer.hh:216

◆ ~G4RayTracerViewer()

G4RayTracerViewer::~G4RayTracerViewer ( )
virtual

Definition at line 56 of file G4RayTracerViewer.cc.

56{}

Member Function Documentation

◆ ClearView()

void G4RayTracerViewer::ClearView ( void  )
virtual

Implements G4VViewer.

Definition at line 94 of file G4RayTracerViewer.cc.

94{}

◆ DrawView()

void G4RayTracerViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 96 of file G4RayTracerViewer.cc.

97{
98 // Trap recursive call
99 static G4bool called = false;
100 if (called) return;
101 called = true;
102
103 if (fVP.GetFieldHalfAngle() == 0.) { // Orthogonal (parallel) projection.
104 G4double fieldHalfAngle = perMillion;
105 fVP.SetFieldHalfAngle(fieldHalfAngle);
106 G4cout <<
107 "WARNING: G4RayTracerViewer::DrawView: true orthogonal projection"
108 "\n not yet implemented. Doing a \"long shot\", i.e., a perspective"
109 "\n projection with a half field angle of "
110 << fieldHalfAngle <<
111 " radians."
112 << G4endl;
113 SetView(); // With this fieldHalfAngle
114 ProcessView();
116 }
117 else {
118 ProcessView();
119 }
120 std::ostringstream filename;
121 filename << "g4RayTracer." << fShortName << '_'
122 << std::setw(4) << std::setfill('0') << fFileCount++ << ".jpeg";
123 theTracer->Trace(filename.str());
124
125 // Reset call flag
126 called = false;
127}
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
G4GLOB_DLL std::ostream G4cout
virtual void Trace(const G4String &fileName)
void ProcessView()
Definition: G4VViewer.cc:104
G4String fShortName
Definition: G4VViewer.hh:218
G4ViewParameters fVP
Definition: G4VViewer.hh:219
void SetFieldHalfAngle(G4double fieldHalfAngle)
G4double GetFieldHalfAngle() const

◆ GetTracer()

G4TheRayTracer * G4RayTracerViewer::GetTracer ( )
inline

Definition at line 47 of file G4RayTracerViewer.hh.

47{return theTracer;}

Referenced by G4RTMessenger::SetNewValue().

◆ Initialise()

void G4RayTracerViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 58 of file G4RayTracerViewer.cc.

59{
62}
void SetNRow(G4int val)
void SetNColumn(G4int val)
unsigned int GetWindowSizeHintX() const
unsigned int GetWindowSizeHintY() const

◆ SetView()

void G4RayTracerViewer::SetView ( )
virtual

Implements G4VViewer.

Definition at line 64 of file G4RayTracerViewer.cc.

65{
66 // Get radius of scene, etc. (See G4OpenGLViewer::SetView().)
67 // Note that this procedure properly takes into account zoom, dolly and pan.
68 const G4Point3D& targetPoint
71 G4double radius = // See G4ViewParameters for following procedure.
73 if(radius<=0.) radius = 1.;
74 const G4double cameraDistance = fVP.GetCameraDistance(radius);
75 const G4Point3D cameraPosition =
76 targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
77 const G4double nearDistance = fVP.GetNearDistance(cameraDistance,radius);
78 const G4double frontHalfHeight = fVP.GetFrontHalfHeight(nearDistance,radius);
79 const G4double frontHalfAngle = std::atan(frontHalfHeight / nearDistance);
80
81 // Calculate and set ray tracer parameters.
82 theTracer->
83 SetViewSpan(200. * frontHalfAngle / theTracer->GetNColumn());
84 theTracer->SetTargetPosition(targetPoint);
85 theTracer->SetEyePosition(cameraPosition);
87 const G4Vector3D
88 actualLightpointDirection(-fVP.GetActualLightpointDirection());
89 theTracer->SetLightDirection(actualLightpointDirection);
91}
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
void SetTargetPosition(const G4ThreeVector &val)
void SetUpVector(const G4ThreeVector &val)
G4int GetNColumn() const
void SetLightDirection(const G4ThreeVector &val)
void SetBackgroundColour(const G4Colour &val)
void SetEyePosition(const G4ThreeVector &val)
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:215
G4double GetCameraDistance(G4double radius) const
G4Vector3D & GetActualLightpointDirection()
const G4Colour & GetBackgroundColour() const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
const G4Vector3D & GetUpVector() const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
BasicVector3D< T > unit() const

Referenced by DrawView().

Member Data Documentation

◆ fFileCount

G4int G4RayTracerViewer::fFileCount
protected

Definition at line 49 of file G4RayTracerViewer.hh.

Referenced by DrawView().

◆ theTracer

G4TheRayTracer* G4RayTracerViewer::theTracer
protected

Definition at line 50 of file G4RayTracerViewer.hh.

Referenced by DrawView(), G4RayTracerViewer(), GetTracer(), Initialise(), and SetView().


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