[vtkusers] vtkClipPolyData does not clip properly.

Sebastien_MARAUX maraux at ondim.fr
Wed Jun 5 14:37:45 EDT 2002


Hello,

With selection Loop as an implicit
function, vtkClipPolyData does not
clip as I think it should : It only
keeps faces entirely contained by
the clip volume, instead of producing
new triangles when faces are partially
contained by the clip volume.

Usually, vtkClipPolyData is able to produce 
new triangles to respect clipping Volume,

How can I obtain those triangles ?
Is there a probleme with InsideOutOn ?

here is my code :

/*============================================*/
   vtkIdList     *DEMPoints = vtkIdList::New();
   vtkImplicitSelectionLoop *clipLoop = vtkImplicitSelectionLoop::New();
   points->Reset();
   
   // recuperation de la cellule courante
   dataGISClean->GetCellPoints(i,DEMPoints);
   
   clipLoop->SetLoop(points);
   clipLoop->SetNormal(0.0,1.0,0.0); // my y is height cause of vrml export
   
   // ajout du clipping du mnt selon les polygones
   vtkClipPolyData *clipper3=vtkClipPolyData::New();
   clipper3->SetInput(pdn->GetOutput());
   clipper3->GenerateClipScalarsOn();
   clipper3->SetClipFunction(clipLoop);
   clipper3->GenerateClippedOutputOff();
   clipper3->InsideOutOn();
   clipper3->SetValue(0.5);
   clipper3->Update();
   
   cout <<i <<"/" <<dataGISClean->GetNumberOfPolys() <<endl;
   cout <<"nombre de polygones : " <<clipper3->GetOutput()->GetNumberOfPolys() <<endl;
   
   if (dataGISClean->GetNumberOfCells() > 0){
    vtkIdList *listCells = vtkIdList::New();
    for (j=0;j<clipper3->GetOutput()->GetNumberOfCells();j++)
    {
     listCells->InsertNextId(j);
    }
    
    //clipper3->GetOutput() does not contain a properly clipped DEM
    dataGIS1->CopyCells(clipper3->GetOutput(),listCells);
   }
/*===============================================================*/


Sebastien MARAUX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020605/720e3a31/attachment.htm>


More information about the vtkusers mailing list