Geant4  10.02.p03
G4RayTracerViewer Class Reference

#include <G4RayTracerViewer.hh>

Inheritance diagram for G4RayTracerViewer:
Collaboration 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 ()
 
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
 
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
 

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 45 of file G4RayTracerViewer.cc.

47  :
48  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name),
49  fFileCount(0)
50 {
51  theTracer = aTracer;
52 #ifdef G4MULTITHREADED
55 #else
56  if (!aTracer) theTracer = new G4TheRayTracer;
57 #endif
60 }
G4String name
Definition: TRTMaterials.hh:40
G4int IncrementViewCount()
void SetNRow(G4int val)
void SetNColumn(G4int val)
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition: G4VViewer.cc:45
G4ViewParameters fVP
Definition: G4VViewer.hh:160
unsigned int GetWindowSizeHintX() const
G4TheRayTracer * theTracer
static G4TheMTRayTracer * theInstance
unsigned int GetWindowSizeHintY() const
Here is the call graph for this function:

◆ ~G4RayTracerViewer()

G4RayTracerViewer::~G4RayTracerViewer ( )
virtual

Definition at line 62 of file G4RayTracerViewer.cc.

62 {}

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(); // Special graphics system - bypass ProcessView().
115  }
116  else {
117  SetView(); // Special graphics system - bypass ProcessView().
118  }
119  std::ostringstream filename;
120  filename << "g4RayTracer." << fShortName << '_' << fFileCount++ << ".jpeg";
121  theTracer->Trace(filename.str());
122 
123  // Reset call flag
124  called = false;
125 }
virtual void Trace(const G4String &fileName)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void SetFieldHalfAngle(G4double fieldHalfAngle)
G4ViewParameters fVP
Definition: G4VViewer.hh:160
static const double perMillion
Definition: G4SIunits.hh:331
G4TheRayTracer * theTracer
#define G4endl
Definition: G4ios.hh:61
G4String fShortName
Definition: G4VViewer.hh:159
double G4double
Definition: G4Types.hh:76
G4double GetFieldHalfAngle() const
Here is the call graph for this function:

◆ GetTracer()

G4TheRayTracer* G4RayTracerViewer::GetTracer ( )
inline

Definition at line 47 of file G4RayTracerViewer.hh.

47 {return theTracer;}
G4TheRayTracer * theTracer
Here is the caller graph for this function:

◆ 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 }
void SetLightDirection(const G4ThreeVector &val)
G4Vector3D & GetActualLightpointDirection()
G4Scene * GetScene() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
G4int GetNColumn() const
const G4Vector3D & GetUpVector() const
G4double GetCameraDistance(G4double radius) const
const G4Vector3D & GetViewpointDirection() const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
void SetUpVector(const G4ThreeVector &val)
G4ViewParameters fVP
Definition: G4VViewer.hh:160
const G4Point3D & GetCurrentTargetPoint() const
void SetBackgroundColour(const G4Colour &val)
G4TheRayTracer * theTracer
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
const G4Colour & GetBackgroundColour() const
double G4double
Definition: G4Types.hh:76
BasicVector3D< T > unit() const
void SetEyePosition(const G4ThreeVector &val)
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:156
void SetTargetPosition(const G4ThreeVector &val)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fFileCount

G4int G4RayTracerViewer::fFileCount
protected

Definition at line 49 of file G4RayTracerViewer.hh.

◆ theTracer

G4TheRayTracer* G4RayTracerViewer::theTracer
protected

Definition at line 50 of file G4RayTracerViewer.hh.


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