-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcylinder.cpp
38 lines (30 loc) · 1.28 KB
/
cylinder.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <vtkActor.h>
#include <vtkCylinderSource.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
auto main() -> int {
const auto cylinder = vtkSmartPointer<vtkCylinderSource>::New();
cylinder->SetResolution(100);
auto cylinder_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
cylinder_mapper->SetInputConnection(cylinder->GetOutputPort());
const auto cylinder_actor = vtkSmartPointer<vtkActor>::New();
cylinder_actor->SetMapper(cylinder_mapper);
const auto cylinder_render = vtkSmartPointer<vtkRenderer>::New();
cylinder_render->AddActor(cylinder_actor);
const auto cylinder_render_window = vtkSmartPointer<vtkRenderWindow>::New();
cylinder_render_window->AddRenderer(cylinder_render);
const auto cylinder_interactor_style
= vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
const auto cylinder_interator
= vtkSmartPointer<vtkRenderWindowInteractor>::New();
cylinder_interator->SetRenderWindow(cylinder_render_window);
cylinder_interator->SetInteractorStyle(cylinder_interactor_style);
cylinder_render_window->Render();
cylinder_interator->Initialize();
cylinder_interator->Start();
return 0;
}