#include "../vtk/include/vtkconesource.h"
#include "../vtk/include/vtkpolydatamapper.h"
#include "../vtk/include/vtkactor.h"
#include "../vtk/include/vtkrenderer.h"
#include "../vtk/include/vtkrenderwindow.h"
#include "../vtk/include/vtkRenderWindowInteractor.h"
#include "../vtk/include/vtkInteractorStyleTrackballCamera.h"
#include "../vtk/include/vtkInteractorStyleTrackballActor.h"
int main(int argc, char* argv[])
{
//建立模型1
vtkConeSource *cone=vtkConeSource::New();
cone->SetHeight(5);
cone->SetCenter(0,0,0);
cone->SetRadius(2);
cone->SetResolution(100);
vtkPolyDataMapper * map=vtkPolyDataMapper::New();
map->SetInput(cone->GetOutput());
vtkActor *actor=vtkActor::New();
actor->SetMapper(map);
//建立模型2
vtkConeSource *cone1=vtkConeSource::New();
cone1->SetHeight(5);
cone1->SetCenter(10,0,0);
cone1->SetRadius(2);
cone1->SetResolution(100);
vtkPolyDataMapper * map1=vtkPolyDataMapper::New();
map1->SetInput(cone1->GetOutput());
vtkActor *actor1=vtkActor::New();
actor1->SetMapper(map1);
//建立模型3
vtkConeSource *cone2=vtkConeSource::New();
cone2->SetHeight(5);
cone2->SetCenter(20,0,0);
cone2->SetRadius(2);
cone2->SetResolution(100);
vtkPolyDataMapper * map2=vtkPolyDataMapper::New();
map2->SetInput(cone2->GetOutput());
vtkActor *actor2=vtkActor::New();
actor2->SetMapper(map2);
//设置render
vtkRenderer * ren=vtkRenderer::New();
ren->AddActor(actor);
ren->AddActor(actor1);
ren->AddActor(actor2);
ren->SetBackground(.9,.5,.4);
vtkRenderWindow* win=vtkRenderWindow::New();
win->AddRenderer(ren);
win->SetSize(600,480);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(win);
iren->Initialize();
//设置观察交互模式
//vtkInteractorStyleTrackballCamera *pvtkInteractorStyleTrackballCamera=vtkInteractorStyleTrackballCamera::New();
//iren->SetInteractorStyle(pvtkInteractorStyleTrackballCamera);
vtkInteractorStyleTrackballActor *pvtkInteractorStyleTrackballActor=vtkInteractorStyleTrackballActor::New();
iren->SetInteractorStyle(pvtkInteractorStyleTrackballActor);
win->Render();
//开始交互
iren->Start();
return 0;
}