Geant4 11.1.1
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)
 
virtual void Execute (vtkObject *caller, unsigned long, void *)
 

Static Public Member Functions

static vtkGeant4CallbackNew ()
 

Protected Attributes

G4ViewParametersfVP
 
G4double parallelScale
 
G4double cameraDistance
 

Detailed Description

Definition at line 58 of file G4VtkViewer.hh.

Constructor & Destructor Documentation

◆ vtkGeant4Callback()

vtkGeant4Callback::vtkGeant4Callback ( )
inline

Definition at line 63 of file G4VtkViewer.hh.

63{ fVP = nullptr; }
G4ViewParameters * fVP
Definition: G4VtkViewer.hh:99

Member Function Documentation

◆ Execute()

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

Definition at line 70 of file G4VtkViewer.hh.

71 {
72 vtkRenderer *ren = static_cast<vtkRenderer *>(caller);
73 vtkCamera *cam = ren->GetActiveCamera();
74 //G4cout << cam->GetFocalPoint()[0] << " " << cam->GetFocalPoint()[1] << " " << cam->GetFocalPoint()[2] << G4endl;
75 //
76 // G4cout << cam->GetPosition()[0] << " " << cam->GetPosition()[1] << " " << cam->GetPosition()[2] << G4endl;
77
78 auto cp = cam->GetPosition();
79 auto fp = cam->GetFocalPoint();
80 auto ud = cam->GetViewUp();
81
82 fVP->SetCurrentTargetPoint(G4Point3D(fp[0],fp[1],fp[2]));
83 fVP->SetViewpointDirection((G4Point3D(cp[0],cp[1],cp[2]) -
84 G4Point3D(fp[0],fp[1],fp[2])).unit());
85 fVP->SetUpVector(G4Vector3D(ud[0],ud[1], ud[2]));
86
87 if(cam->GetParallelProjection()) {
88 fVP->SetZoomFactor(parallelScale/cam->GetParallelScale());
89 }
90 else {
91 auto cd = std::sqrt(std::pow(cp[0]-fp[0],2) +
92 std::pow(cp[1]-cp[1],2) +
93 std::pow(cp[2]-cp[2],2));
95 }
96 }
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 parallelScale
Definition: G4VtkViewer.hh:100
G4double cameraDistance
Definition: G4VtkViewer.hh:101

◆ New()

static vtkGeant4Callback * vtkGeant4Callback::New ( )
inlinestatic

Definition at line 61 of file G4VtkViewer.hh.

61{return new vtkGeant4Callback;}

◆ SetGeant4ViewParameters()

void vtkGeant4Callback::SetGeant4ViewParameters ( G4ViewParameters VP)
inline

Definition at line 64 of file G4VtkViewer.hh.

64{ fVP = VP;}

◆ SetVtkInitialValues()

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

Definition at line 65 of file G4VtkViewer.hh.

66 {
67 parallelScale = parallelScaleIn;
68 cameraDistance = cameraDistanceIn;
69 }

Member Data Documentation

◆ cameraDistance

G4double vtkGeant4Callback::cameraDistance
protected

Definition at line 101 of file G4VtkViewer.hh.

◆ fVP

G4ViewParameters* vtkGeant4Callback::fVP
protected

Definition at line 99 of file G4VtkViewer.hh.

◆ parallelScale

G4double vtkGeant4Callback::parallelScale
protected

Definition at line 100 of file G4VtkViewer.hh.


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