本文整理汇总了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;
}