40#pragma GCC diagnostic push 
   41#pragma GCC diagnostic ignored "-Wextra-semi" 
   43#include "vtkAutoInit.h" 
   46#include "vtkRenderer.h" 
   47#include "vtkRenderWindow.h" 
   48#include "vtkRenderWindowInteractor.h" 
   49#include "vtkInteractorStyleTrackballCamera.h" 
   50#include "vtkInteractorStyleTerrain.h" 
   51#include "vtkTextActor.h" 
   52#pragma GCC diagnostic pop 
   67    parallelScale = parallelScaleIn;
 
   68    cameraDistance = cameraDistanceIn;
 
   70  virtual void Execute(vtkObject *caller, 
unsigned long, 
void*)
 
   72    vtkRenderer *ren = 
reinterpret_cast<vtkRenderer *
>(caller);
 
   73    vtkCamera *cam = ren->GetActiveCamera();
 
   78    auto cp = cam->GetPosition();
 
   79    auto fp = cam->GetFocalPoint();
 
   80    auto ud = cam->GetViewUp();
 
   82    fVP->SetCurrentTargetPoint(
G4Point3D(fp[0],fp[1],fp[2]));
 
   85    fVP->SetUpVector(
G4Vector3D(ud[0],ud[1], ud[2]));
 
   87    if(cam->GetParallelProjection()) {
 
   88      fVP->SetZoomFactor(parallelScale/cam->GetParallelScale());
 
   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));
 
   94      fVP->SetZoomFactor(cameraDistance/
cd);
 
  110    t1 = std::chrono::steady_clock::now();
 
  111    t2 = std::chrono::steady_clock::now();
 
  115  virtual void Execute(vtkObject *caller, 
unsigned long, 
void*)
 
  117    vtkRenderer *ren = 
reinterpret_cast<vtkRenderer *
>(caller);
 
  118    int      nActors = ren->GetActors()->GetNumberOfItems();
 
  119    vtkCamera   *cam = ren->GetActiveCamera();
 
  122    double      *
pos     = cam->GetPosition();
 
  123    double      *foc     = cam->GetFocalPoint();
 
  124    double viewAngle     = cam->GetViewAngle();
 
  125    double distance      = cam->GetDistance();
 
  126    double parallelScale = cam->GetParallelScale();
 
  131    t2 = std::chrono::steady_clock::now();
 
  134    std::chrono::duration<double> tdiff = 
t2-
t1;
 
  136    float fps = 1.0/tdiff.count();
 
  139    sprintf(this->
TextBuff,
"camera position    : %.1f %.1f %.1f \n" 
  140                           "camera focal point : %.1f %.1f %.1f \n" 
  141                           "view angle         : %.1f\n" 
  143                           "parallel scale     : %.1f\n" 
  144                           "number actors      : %i\n" 
  145                           "fps                : %.1f",pos[0], 
pos[1], 
pos[2], foc[0], foc[1], foc[2], viewAngle, distance, parallelScale, nActors, fps);
 
  153  std::chrono::time_point<std::chrono::steady_clock> 
t1;
 
  154  std::chrono::time_point<std::chrono::steady_clock> 
t2;
 
static const G4double pos
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
VTK_MODULE_INIT(vtkInteractionStyle)
vtkNew< vtkCamera > camera
vtkSmartPointer< vtkLight > light
void ExportVRMLScene(G4String)
vtkNew< vtkGeant4Callback > geant4Callback
void ExportScreenShot(G4String, G4String)
vtkNew< vtkTextActor > infoTextActor
vtkRenderWindowInteractor * renderWindowInteractor
G4VtkViewer(G4VSceneHandler &, const G4String &name)
vtkNew< vtkInfoCallback > infoCallback
vtkNew< vtkRenderer > renderer
void ExportVTPScene(G4String)
void ExportOBJScene(G4String)
vtkRenderWindow * _renderWindow
void SetGeant4ViewParameters(G4ViewParameters *VP)
static vtkGeant4Callback * New()
virtual void Execute(vtkObject *caller, unsigned long, void *)
void SetVtkInitialValues(G4double parallelScaleIn, G4double cameraDistanceIn)
void SetTextActor(vtkTextActor *txt)
virtual void Execute(vtkObject *caller, unsigned long, void *)
std::chrono::time_point< std::chrono::steady_clock > t2
static vtkInfoCallback * New()
std::chrono::time_point< std::chrono::steady_clock > t1
const char * name(G4int ptype)