[vtkusers] External contour of a 2D vtkPolyData (vtkSilhouette+vtkPolyDataConnectivityFilter)

nsarrasin nsarrasin at phenix-systems.com
Tue Oct 26 05:51:54 EDT 2010


Hi all,

I'd like to get the external contour of a planar vtkPolyData.

I've looked around vtkSilhouette with vtkPolyDataConnectivityFilter but
didn't get the expected result.

I've tried to use SetExtractionModeToAllRegions() then compare the
boundingbox of each region.

The performances are very very low especially when
vtkPolyDataConnectivityFilter->Update() so either I'm not using this filter
correctly neither there is another solution.

Can someone explain me why is this so low ? And how can I proceed to gain
time ?

Thanks by advance.

here is a sample of my code :

vtkPolyData* resultLargest = vtkPolyData::New();
vtkBoundingBox largestbox(-1.,1.,-1.,1.,0.,0.);

int nbcont = cF->GetNumberOfExtractedRegions();

for(int i=0; i<nbcont; i++)
{
	cF->AddSpecifiedRegion(i); 
	cF->Update();  //very low !!

	vtkPolyData* tmp = vtkPolyData::New();
	tmp=cF->GetOutput();
	vtkBoundingBox tmpbox(tmp->GetBounds());
		
	if( tmpbox.Contains(largestbox) )
	{
		resultLargest->DeepCopy(tmp);

		double coords[6];
		tmpbox.GetBounds(coords);
		largestbox.SetBounds(coords);
	}
}


-- 
View this message in context: http://vtk.1045678.n5.nabble.com/External-contour-of-a-2D-vtkPolyData-vtkSilhouette-vtkPolyDataConnectivityFilter-tp3236771p3236771.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list