[vtk-developers] Should vtkClipPolyData keep the normals?

Mathieu Coursolle mcoursolle at rogue-research.com
Tue Sep 9 15:15:46 EDT 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20080909/af64a43e/attachment.html>


More information about the vtk-developers mailing list