[vtkusers] Problem with color after using vtkClipPolyData

gongweixue gongweixue at sina.com
Wed Dec 12 20:54:45 EST 2012


Thanks for your answer.
Yes, I also have tried to clip polydata, not normals.
But the result's color is just not same as the original model.
So I think maybe it is my model's problem,because the model is converted from a vrml model. 
I used vtkTableBasedClipDataSet, and the color is right. I was confused.
And when treat it as a DataSet with normals, the color is right. 
Do you know the reason?

Thank you very much!
2012/12/13 
gongweixue at sina.com
----- Original Message ----- 
From: Alex Malyushytskyy 
To: vtkusers 
Date: 2012-12-13, 07:34:12
Subject: Re: [vtkusers] Problem with color after using vtkClipPolyData


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
>
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121213/f2da4781/attachment.htm>


More information about the vtkusers mailing list