码迷,mamicode.com
首页 > 其他好文 > 详细

vtk 基础概念

时间:2014-05-01 04:58:32      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:style   c   t   size   tar   sp   width   art   get   color   int   

#include <vtk-5.10/vtkSmartPointer.h>
#include <vtk-5.10/vtkRenderWindow.h>
#include <vtk-5.10/vtkRenderer.h>
#include <vtk-5.10/vtkCylinderSource.h>
#include <vtk-5.10/vtkPolyDataMapper.h>
#include <vtk-5.10/vtkActor.h>
#include <vtk-5.10/vtkRenderWindowInteractor.h>
#include <vtk-5.10/vtkInteractorStyleTrackballCamera.h>
int main()
{
    vtkSmartPointer<vtkCylinderSource> cylinder=vtkSmartPointer<vtkCylinderSource>::New();
    cylinder->SetHeight(3.0);
    cylinder->SetRadius(1.0);
    cylinder->SetResolution(10);
    
    vtkSmartPointer<vtkPolyDataMapper> polydata=vtkSmartPointer<vtkPolyDataMapper>::New();
    polydata->SetInputConnection(cylinder->GetOutputPort());
    
    vtkSmartPointer<vtkActor> cylinderActor=vtkSmartPointer<vtkActor>::New();
    cylinderActor->SetMapper(polydata);
    
    vtkSmartPointer<vtkRenderer> render=vtkSmartPointer<vtkRenderer>::New();
    render->AddActor(cylinderActor);
    render->SetBackground(0.1, 0.2, 0.4);
    
    vtkSmartPointer<vtkRenderWindow> renderWindow=vtkSmartPointer<vtkRenderWindow >::New();
    renderWindow->AddRenderer(render);
    renderWindow->SetSize(640, 480);
    
    vtkSmartPointer<vtkRenderWindowInteractor> renderwindowInteractor=vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderwindowInteractor->SetRenderWindow(renderWindow);
    
    vtkSmartPointer<vtkInteractorStyleTrackballCamera> interactorStyle =vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
    renderwindowInteractor->SetInteractorStyle(interactorStyle);
    renderwindowInteractor->Initialize();
    renderwindowInteractor->Start();
    
    std::cin.get();
    return 0;
}

vtk 基础概念,码迷,mamicode.com

vtk 基础概念

标签:style   c   t   size   tar   sp   width   art   get   color   int   

原文地址:http://www.cnblogs.com/gujianhan/p/3702057.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!