Geant4 9.6.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 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 ()
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () 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
 

Detailed Description

Definition at line 38 of file G4RayTracerViewer.hh.

Constructor & Destructor Documentation

◆ G4RayTracerViewer()

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

Definition at line 40 of file G4RayTracerViewer.cc.

43 :
44 G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name),
45 fFileCount(0)
46{
47 theTracer = aTracer;
48 if (!aTracer) theTracer = new G4TheRayTracer;
51}
G4TheRayTracer * theTracer
void SetNRow(G4int val)
void SetNColumn(G4int val)
G4int IncrementViewCount()
G4ViewParameters fVP
Definition: G4VViewer.hh:137
unsigned int GetWindowSizeHintX() const
unsigned int GetWindowSizeHintY() const

◆ ~G4RayTracerViewer()

G4RayTracerViewer::~G4RayTracerViewer ( )
virtual

Definition at line 53 of file G4RayTracerViewer.cc.

53{}

Member Function Documentation

◆ ClearView()

void G4RayTracerViewer::ClearView ( void  )
virtual

Implements G4VViewer.

Definition at line 85 of file G4RayTracerViewer.cc.

85{}

◆ DrawView()

void G4RayTracerViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 87 of file G4RayTracerViewer.cc.

88{
89 // Trap recursive call
90 static G4bool called = false;
91 if (called) return;
92 called = true;
93
94 if (fVP.GetFieldHalfAngle() == 0.) { // Orthogonal (parallel) projection.
95 G4double fieldHalfAngle = perMillion;
96 fVP.SetFieldHalfAngle(fieldHalfAngle);
97 G4cout <<
98 "WARNING: G4RayTracerViewer::DrawView: true orthogonal projection"
99 "\n not yet implemented. Doing a \"long shot\", i.e., a perspective"
100 "\n projection with a half field angle of "
101 << fieldHalfAngle <<
102 " radians."
103 << G4endl;
104 SetView(); // Special graphics system - bypass ProcessView().
106 }
107 else {
108 SetView(); // Special graphics system - bypass ProcessView().
109 }
110 std::ostringstream filename;
111 filename << "g4RayTracer." << fShortName << '_' << fFileCount++ << ".jpeg";
112 theTracer->Trace(filename.str());
113
114 // Reset call flag
115 called = false;
116}
double G4double
Definition: G4Types.hh:64
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void Trace(G4String fileName)
G4String fShortName
Definition: G4VViewer.hh:136
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().

◆ SetView()

void G4RayTracerViewer::SetView ( )
virtual

Implements G4VViewer.

Definition at line 55 of file G4RayTracerViewer.cc.

56{
57 // Get radius of scene, etc. (See G4OpenGLViewer::SetView().)
58 // Note that this procedure properly takes into account zoom, dolly and pan.
59 const G4Point3D& targetPoint
62 G4double radius = // See G4ViewParameters for following procedure.
64 if(radius<=0.) radius = 1.;
65 const G4double cameraDistance = fVP.GetCameraDistance(radius);
66 const G4Point3D cameraPosition =
67 targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
68 const G4double nearDistance = fVP.GetNearDistance(cameraDistance,radius);
69 const G4double frontHalfHeight = fVP.GetFrontHalfHeight(nearDistance,radius);
70 const G4double frontHalfAngle = std::atan(frontHalfHeight / nearDistance);
71
72 // Calculate and set ray tracer parameters.
73 theTracer->
74 SetViewSpan(200. * frontHalfAngle / theTracer->GetNColumn());
75 theTracer->SetTargetPosition(targetPoint);
76 theTracer->SetEyePosition(cameraPosition);
78 const G4Vector3D
79 actualLightpointDirection(-fVP.GetActualLightpointDirection());
80 theTracer->SetLightDirection(actualLightpointDirection);
82}
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(G4Colour val)
void SetEyePosition(const G4ThreeVector &val)
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:133
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:73
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(), and SetView().


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