VTKFIG  0.20.20181114
Easy VTK based in situ visualization
int main ( void  )

Definition at line 38 of file example-context2d.cxx.

39 {
40 
41  cout <<
42 R"(
43 Example showing creation of custom scenes using
44 vtkfigFrame and vtkfigFigure base class.
45 )";
46 
47  size_t nspin=vtkfig::NSpin();
48 
49  cout.sync_with_stdio(true);
50 
51 
52  auto frame=vtkfig::Frame::New();
53  auto figure=vtkfig::Figure::New();
54  figure->SetViewVolume(0,1,0,1,0,1);
55 
56  auto cactor=vtkContextActor::New();
57  auto drawing=MyDrawing::New();
58  cactor->GetScene()->AddItem(drawing);
59  figure->RTAddContextActor(cactor);
60  frame->AddFigure(figure);
61 
62 
63  auto t0=std::chrono::system_clock::now();
64 
65 
66 
67  int ii=0;
68  int i0=0;
69  while (ii <nspin)
70  {
71  auto t1=std::chrono::system_clock::now();
72  double dt=std::chrono::duration_cast<std::chrono::duration<double>>(t1-t0).count();
73  int i1=ii;
74  drawing->delta+=0.5;
75  frame->Show();
76  if (dt>4.0)
77  {
78  printf("Frame rate: %.2f fps\n",(double)(i1-i0)/4.0);
79  t0=std::chrono::system_clock::now();
80  i0=ii;
81  fflush(stdout);
82  }
83  ii++;
84  }
85 
86 }
size_t NSpin()
Definition: vtkfigTools.cxx:13
static std::shared_ptr< Frame > New()
Create frame with multiple subframes.
Definition: vtkfigFrame.h:54
static std::shared_ptr< Figure > New()
Construct smartpointer to empty figure.
Definition: vtkfigFigure.h:61
static MyDrawing * New()

+ Here is the call graph for this function: