[vtkusers] Problem trying to smooth a Delaunay Surface
Chris Hawkins
Chris.Hawkins at Unilever.com
Thu May 12 07:20:18 EDT 2005
Hi,
I've been struggling with a problem for a while now so would very much
appreciate some advice.
I've have a set of point data that I want to triangulate using the Delaunay
functionality.
I then want to tidy up the generated surface by passing this through a
smoothing filter.
Unfortunately, I'm not having any success smoothing any data that has been
contructed from the Delaunay process. Can anyone see where 'm going wrong??
The process I've adopted is follows:
1. Pass point data to vtkDelaunay3D
2. Pass through a Geometry filter to convert from unstructured grid to polydata
3. Optional bit of decimation (note I don't decimate in my sample code)
4. Use vtkSmoothPolyDataFilter to improve the captured surface.
//do we need to recompute the delaunay structure
if(bNewDelaunay)
{
//delete the old filter
if(m_pVtkDelFilter)
m_pVtkDelFilter->Delete();
//create the Delaunay object that is going to do the work
m_pVtkDelFilter = vtkDelaunay3D::New();
//pass the data to the filter
m_pVtkDelFilter->SetInput(m_pVtkDelaunayData);
//set the parameters
m_pVtkDelFilter->SetTolerance(fTolerance);
m_pVtkDelFilter->SetAlpha(fAlpha);
m_pVtkDelFilter->SetBoundingTriangulation(TRUE);
}
//turn this del unstructured grid into poly data
vtkGeometryFilter *pGeomFilter = vtkGeometryFilter::New();
pGeomFilter->SetInput(m_pVtkDelFilter->GetOutput());
//do a bit of decimation
vtkDecimatePro *pDeci = vtkDecimatePro::New();
pDeci->SetInput(pGeomFilter->GetOutput());
pDeci->SetTargetReduction(0.0);
//ok, now lets try some filtering
vtkSmoothPolyDataFilter * pSmooth = vtkSmoothPolyDataFilter::New();
pSmooth->SetInput(pDeci->GetOutput());
pSmooth->SetNumberOfIterations(fIter);
pSmooth->SetRelaxationFactor(fRelax);
pSmooth->SetFeatureEdgeSmoothing(TRUE);
pSmooth->SetFeatureAngle(fFeature);
pSmooth->SetEdgeAngle(fEdge);
pSmooth->SetBoundarySmoothing(TRUE);
pSmooth->Update();
//now render this
vtkDataSetMapper *pVtkMapper = vtkDataSetMapper::New();
pVtkMapper->SetInput(pSmooth->GetOutput());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-cdsi-msrtf
Size: 2419 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050512/8be588ac/attachment.bin>
More information about the vtkusers
mailing list