[vtkusers] Problem with color after using vtkClipPolyData

gongweixue gongweixue at sina.com
Wed Dec 12 01:18:03 EST 2012


hi guys,
I used a vtkClipPolyData to clip  polydata, and I found that the color of surfaces after clipping is changed.
So,dose anybody know the reason?
here is my code.

//////////////////////code/////////////////////////////
 vtkPolyDataReader *reader=vtkPolyDataReader::New();
 reader->SetFileName(FILENAME);
 reader->Update();

 vtkClipPolyData * clipper=vtkClipPolyData::New();
 clipper->SetInput(normals->GetOutput());
 vtkPlane * plane = vtkPlane::New();
 plane->SetOrigin(0.5,0,0);
 plane->SetNormal(1,1,1);
 clipper->SetClipFunction(plane);
 clipper->SetValue(0.5);
 clipper->SetInsideOut(1);
 clipper->Update();

 vtkPolyDataMapper *mapper=vtkPolyDataMapper::New();
 mapper->SetInput(clipper->GetOutput());
 vtkActor *actor=vtkActor::New();
 actor->SetMapper(mapper);
 vtkRenderer *ren1= vtkRenderer::New();
 ren1->AddActor( actor );
 ren1->SetBackground( 0.1, 0.2, 0.4 );
 vtkRenderWindow *renWin = vtkRenderWindow::New();
 renWin->AddRenderer( ren1 );
 renWin->SetSize( 600, 600 );
 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
 iren->SetRenderWindow(renWin);
 vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();
 iren->SetInteractorStyle(style);
 iren->Initialize();
 iren->Start();
///////////////////////////////////////////////
And here is the pic: http://p13.freep.cn/p.aspx?u=v20_p13_photo_1212121410379520_0.jpg

I will appreciate any suggestion very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121212/f121d395/attachment.htm>


More information about the vtkusers mailing list