[vtkusers] Problem with color after using vtkClipPolyData

Alex Malyushytskyy alexmalvtk at gmail.com
Wed Dec 12 18:34:12 EST 2012


Self-sufficient example would help.
As is I can only guess  that you probably did not want to clip normal
as you currently do
and wanted to clip read polydata:

 clipper->SetInput(reader->GetOutput());

Alex

On Tue, Dec 11, 2012 at 10:18 PM, gongweixue <gongweixue at sina.com> wrote:
> 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!
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list