[vtkusers] A question about surface cutting

Andrea Bottino andrea.bottino at polito.it
Wed May 7 09:53:19 EDT 2008


Hi everybody,
I'd like to make a hole in a 3D surface. I have the contour of the part 
of the surface that must be removed (defined as a set of points). I was 
trying to use vtkExtractGeometry with vtkImplicitSelectionLoop to 
perform the cut, but what I get as result, is just the part of the 
object INSIDE the contour 8while I'd like to obtain the surface with the 
hole). I've checked the documentation and the examples but I couldn't 
find a way to tell that I want to keep the outside of the contour. The 
only way to obtain the desired result was to use vtkClipPolyData, which 
however is much slower than vtkExtractGeometry.
Anybody knows how to solve the problem?

This is an excerpt of the code I'm using

 // this extracts from the surface the internal part of the loop, I'd 
like to get the external part...

 vtkImplicitSelectionLoop* loop = vtkImplicitSelectionLoop::New(); 
  loop->SetLoop( contourPts );
  loop->SetAutomaticNormalGeneration(1);

  vtkExtractGeometry* extract = vtkExtractGeometry::New();
  extract->SetInputConnection( face->getModelSurface() );
  extract->SetImplicitFunction( loop );

  vtkConnectivityFilter* connect = vtkConnectivityFilter::New();
  connect->SetInputConnection(extract->GetOutputPort());
  connect->SetExtractionModeToClosestPointRegion();
  connect->SetClosestPoint( contourPts->GetPoint(0) );

  // to make a hole in the surface

  vtkClipPolyData* clipper = vtkClipPolyData::New();
  clipper->SetInputConnection(face->getModelSurface());
  clipper->SetClipFunction(loop);
  clipper->GenerateClipScalarsOn();
  clipper->GenerateClippedOutputOn();
  clipper->SetValue(0.5);


best regards,

-- 
Andrea Bottino
Politecnico di Torino, DAUIN
Corso Duca degli Abruzzi, 24
10129 Torino ITALY
Tel +39 011 5647175 / Fax +39 011 5647099.
http://www.polito.it/cgvg




More information about the vtkusers mailing list