[vtkusers] Problem with color after using vtkClipPolyData

Gerrick Bivins Gerrick.Bivins at halliburton.com
Fri Dec 14 08:28:18 EST 2012


I had a similar issue and ended up abandoning vtkClipPolyData and instead clipping the source with vtkClipDataSet.
http://www.vtk.org/pipermail/vtkusers/2008-July/096200.html

This was a while ago and I seem to remember digging through vtkClipPolyData source to find the problem but to no avail.
I think there is a bug but having made things work with vtkClipDataSet, I moved on.
Gerrick

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of Alex Malyushytskyy
Sent: Thursday, December 13, 2012 7:50 PM
To: vtkusers
Subject: Re: [vtkusers] Problem with color after using vtkClipPolyData

It is difficult to say without looking in the data and code.
Normal  for example can change color significant due to possible change which side of polygon is counted as inner surface.

But it might be hundred of other reasons and I am not sure I can list all.

Alex

On Wed, Dec 12, 2012 at 5:54 PM, gongweixue <gongweixue at sina.com> wrote:
> 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
>
_______________________________________________
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