[vtkusers] Problem when creating an offset polygonal model

Alexander Trum a.trum at teraport.de
Thu Mar 21 10:47:50 EST 2002


Hello

I'm reading in a polygonal model (a rim of a car wheel) from a STL file.
What i want is an offset polygonal model.
I choose an offset of 1 millimetre.
The dimensions of this model are round about 250*500*500 millimetres.
I choose sample dimensions of 50, 100, 100 so that the modelling is done
with a spacing of 5 millimetres.
Then i create a new polygonal surface with a contour value set to the
offset value.
But the offset polygonal model has a lot of wholes where the original
model has a closed surface.
What did i wrong?

  float offset = 1.0;

  vtkSTLReader* stlReader = vtkSTLReader::New();
  stlReader->SetFileName("/tmp/rim.stl");
  stlReader->MergingOn();
  stlReader->Update();

  vtkImplicitModeller* implicitModeller = vtkImplicitModeller::New();
  implicitModeller->SetInput(stlReader->GetOutput());
  implicitModeller->SetSampleDimensions(50, 100, 100);
  implicitModeller->Update();
  stlReader->Delete(); stlReader = NULL;

  vtkContourFilter* contourFilter = vtkContourFilter::New();
  contourFilter->SetInput(implicitModeller->GetOutput());
  contourFilter->SetValue(0, offset);
  contourFilter->Update();
  implicitModeller->Delete(); implicitModeller = NULL;

  vtkSTLWriter* stlWriter = vtkSTLWriter::New();
  stlWriter->SetFileName("/tmp/offset_rim.stl");
  stlWriter->SetInput(contourFilter->GetOutput());
  stlWriter->Write();
  contourFilter->Delete(); contourFilter = NULL;
  stlWriter->Delete(); stlWriter = NULL;


Thanks in advance,
  Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.trum.vcf
Type: text/x-vcard
Size: 409 bytes
Desc: Karte f?r Alexander Trum
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020321/1762a436/attachment.vcf>


More information about the vtkusers mailing list