当前位置: 首页>>代码示例>>C++>>正文


C++ vtkSmartPointer::AddActor方法代码示例

本文整理汇总了C++中vtkSmartPointer::AddActor方法的典型用法代码示例。如果您正苦于以下问题:C++ vtkSmartPointer::AddActor方法的具体用法?C++ vtkSmartPointer::AddActor怎么用?C++ vtkSmartPointer::AddActor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vtkSmartPointer的用法示例。


在下文中一共展示了vtkSmartPointer::AddActor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv)
{

    // initialize vtk pipeline
	ren = vtkSmartPointer<vtkRenderer>::New();
	renWin = vtkSmartPointer<vtkRenderWindow>::New();
	vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
	renWin->AddRenderer(ren);
	renWin->SetInteractor(iren);
	renWin->SetSize(1024,768);
	
	// mummy
	vtkSmartPointer<vtkDataSetReader> data = vtkSmartPointer<vtkDataSetReader>::New();
	vtkSmartPointer<vtkContourFilter> contour = vtkSmartPointer<vtkContourFilter>::New();
	vtkSmartPointer<vtkPolyDataMapper> cMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	vtkSmartPointer<vtkActor> cActor = vtkSmartPointer<vtkActor>::New();
	cMapper->SetInput(contour->GetOutput());
	cActor->SetMapper(cMapper);
	ren->AddActor(cActor);
	
	// isosurfaces
	data->SetFileName("mummy.128.vtk");
	contour->SetInput(data->GetOutput());
	contour->SetValue(0, 125);
	
	// sphere
	vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
	vtkSmartPointer<vtkPolyDataMapper> sMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	vtkSmartPointer<vtkActor> sActor = vtkSmartPointer<vtkActor>::New();
	sMapper->SetInput(sphere->GetOutput());
	sActor->SetMapper(sMapper);
	ren->AddActor(sActor);
	sphere->SetCenter(50, 500, 0);
	sphere->SetRadius(50);
	
	
	//Add timer callback
	vtkSmartPointer<UpdateData> updateCallback = vtkSmartPointer<UpdateData>::New();
	iren->AddObserver(vtkCommand::TimerEvent, updateCallback);
	iren->CreateRepeatingTimer(100);
	
	// initialize the kinect
	sensor = new SensorDevice();
	sensor->initialize();
	sensor->startGeneratingAll();
	sensor->lookForCalibrationPoseOn();
		
	// initial position of center of camera
	lastPoint.x_ = 320;
	lastPoint.y_ = 240;
	lastPoint.z_ = 0;
	
	iren->Initialize();
	iren->Start();
	
	delete sensor;
	
    return 0;
}
开发者ID:bmwesting,项目名称:Headtracking-VTK-Kinect,代码行数:59,代码来源:main.cpp


注:本文中的vtkSmartPointer::AddActor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。