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

#include <G4VtkViewer.hh>

+ Inheritance diagram for vtkGeant4Callback:

Public Member Functions

 vtkGeant4Callback ()
 
void SetGeant4ViewParameters (G4ViewParameters *VP)
 
void SetVtkInitialValues (G4double parallelScaleIn, G4double cameraDistanceIn)
 
void Execute (vtkObject *caller, unsigned long, void *) override
 

Static Public Member Functions

static vtkGeant4CallbackNew ()
 

Protected Attributes

G4ViewParametersfVP
 
G4double parallelScale
 
G4double cameraDistance
 

Detailed Description

Definition at line 70 of file G4VtkViewer.hh.

Constructor & Destructor Documentation

◆ vtkGeant4Callback()

vtkGeant4Callback::vtkGeant4Callback ( )
inline

Definition at line 75 of file G4VtkViewer.hh.

75{ fVP = nullptr; }
G4ViewParameters * fVP

Member Function Documentation

◆ Execute()

void vtkGeant4Callback::Execute ( vtkObject * caller,
unsigned long ,
void *  )
inlineoverride

Definition at line 82 of file G4VtkViewer.hh.

83 {
84 auto ren = static_cast<vtkRenderer*>(caller);
85 vtkCamera* cam = ren->GetActiveCamera();
86
87 auto cp = cam->GetPosition();
88 auto fp = cam->GetFocalPoint();
89 auto ud = cam->GetViewUp();
90 auto ps = cam->GetParallelScale();
91 auto cd = std::sqrt(std::pow(cp[0] - fp[0], 2) + std::pow(cp[1] - fp[1], 2)
92 + std::pow(cp[2] - fp[2], 2));
93
94 fVP->SetCurrentTargetPoint(G4Point3D(fp[0], fp[1], fp[2]));
95 fVP->SetViewpointDirection((G4Point3D(cp[0], cp[1], cp[2]) - G4Point3D(fp[0], fp[1], fp[2])).unit());
96 fVP->SetUpVector(G4Vector3D(ud[0], ud[1], ud[2]));
97
98 if (cam->GetParallelProjection() != 0) {
100 }
101 else {
103 }
104 }
HepGeom::Point3D< G4double > G4Point3D
Definition G4Point3D.hh:34
HepGeom::Vector3D< G4double > G4Vector3D
Definition G4Vector3D.hh:34
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
void SetCurrentTargetPoint(const G4Point3D &currentTargetPoint)
void SetZoomFactor(G4double zoomFactor)
void SetUpVector(const G4Vector3D &upVector)
G4double cameraDistance

◆ New()

static vtkGeant4Callback * vtkGeant4Callback::New ( )
inlinestatic

Definition at line 73 of file G4VtkViewer.hh.

73{ return new vtkGeant4Callback; }

◆ SetGeant4ViewParameters()

void vtkGeant4Callback::SetGeant4ViewParameters ( G4ViewParameters * VP)
inline

Definition at line 76 of file G4VtkViewer.hh.

76{ fVP = VP; }

◆ SetVtkInitialValues()

void vtkGeant4Callback::SetVtkInitialValues ( G4double parallelScaleIn,
G4double cameraDistanceIn )
inline

Definition at line 77 of file G4VtkViewer.hh.

78 {
79 parallelScale = parallelScaleIn;
80 cameraDistance = cameraDistanceIn;
81 }

Member Data Documentation

◆ cameraDistance

G4double vtkGeant4Callback::cameraDistance
protected

Definition at line 109 of file G4VtkViewer.hh.

◆ fVP

G4ViewParameters* vtkGeant4Callback::fVP
protected

Definition at line 107 of file G4VtkViewer.hh.

◆ parallelScale

G4double vtkGeant4Callback::parallelScale
protected

Definition at line 108 of file G4VtkViewer.hh.


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