[vtk-developers] Should vtkClipPolyData keep the normals?

Berk Geveci berk.geveci at kitware.com
Tue Sep 9 16:44:22 EDT 2008


Something is fishy there. The line you added is copying the point data
onto itself.

  vtkPointData *inPD=input->GetPointData(), *outPD = output->GetPointData();
  ....
  output->GetPointData()->PassData(outPD);

That PassData() should not do anything at best and may corrupt the
output data at worst. Can you post a small example demonstrating the
issue?

-berk


2008/9/9 Mathieu Coursolle <mcoursolle at rogue-research.com>:
> Hi VTK developers,
> I am using vtkClipPolyData to clip a vtkPolyData with an implicit function
> (vtkBox).
> The origin vtkPolyData has specific normals I want to keep for the resulting
> polydata.
> Unfortunately, the normals are not the same in the output polydata.
> I looked at the code, and I have a question regarding the creation of the
> output polydata:
> For the Clipped Output, the PassData() method and the Squeeze() method are
> called one
> the points, lines, polys, strips are set. This is not true for the standard
> output. Is there a reason?
> Shouldn't the code be:
>   if (newVerts->GetNumberOfCells())
>     {
>     output->SetVerts(newVerts);
>     }
>   newVerts->Delete();
>   if (newLines->GetNumberOfCells())
>     {
>     output->SetLines(newLines);
>     }
>   newLines->Delete();
>   if (newPolys->GetNumberOfCells())
>     {
>     output->SetPolys(newPolys);
>     }
>   newPolys->Delete();
>
>
>
>   output->GetPointData()->PassData(outPD);      <<<<<<<<<< ADDED CODE
> <<<<<<<<<<<<
>   output->Squeeze();                            <<<<<<<<<< ADDED CODE
> <<<<<<<<<<<<
>   if ( this->GenerateClippedOutput )
>     {
>     this->GetClippedOutput()->SetPoints(newPoints);
>     if (clippedVerts->GetNumberOfCells())
>       {
>       this->GetClippedOutput()->SetVerts(clippedVerts);
>       }
>     clippedVerts->Delete();
>     if (clippedLines->GetNumberOfCells())
>       {
>       this->GetClippedOutput()->SetLines(clippedLines);
>       }
>     clippedLines->Delete();
>     if (clippedPolys->GetNumberOfCells())
>       {
>       this->GetClippedOutput()->SetPolys(clippedPolys);
>       }
>     clippedPolys->Delete();
>
>
>
>     this->GetClippedOutput()->GetPointData()->PassData(outPD);
>     this->GetClippedOutput()->Squeeze();
>     }
> It seems to work alright with that fix, but I am not too sure of what it is
> doing...
> Thanks!
> Mathieu
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list