[vtkusers] BUG in vtkQuadricClustering?

Hentschel, Bernd hentschel at rz.rwth-aachen.de
Wed Mar 24 09:15:39 EST 2004


Hi all,

I've just been fiddling around with the append functionality of vtkQuadricClustering (using VTK4.2.2). I use it to decimate an isosurface extracted from a number of strucutred grid blocks. My code looks as follows:

vtkQuadricClustering* pCluster = vtkQuadricClustering::New();
float fBounds[6] = {0.0f, 3.54f, -3.63f, 3.63f, -3.63f, 3.63f}; //the bounds of the total data set
float fSpacing[3] = {0.1f,0.1f,0.1f};
float fOrigin[3] = {0.0f,-3.63f,-3.63f};
pCluster->SetDivisionSpacing(fSpacing);
pCluster->SetDivisionOrigin(fOrigin);
pCluster->StartAppend(fBounds);
	
vector<vtkStructuredGridReader*> vecReaders;
vector<vtkContourFilter*> vecContours;
vecReaders.reserve(20);
vecContours.reserve(20);
int i;
for(i=0; i<20; ++i)
{
	vecReaders.push_back(vtkStructuredGridReader::New());
	vecReaders[i]->SetFileName(oDSName.GetFileName(1,i).c_str()); //this just gives me the filename for t=1,block=i

	vecContours.push_back(vtkContourFilter::New());
	vecContours[i]->SetInput(vecReaders[i]->GetOutput());
	vecContours[i]->SetValue(0,0.65);
	vecContours[i]->Update();
	
	pCluster->Append(vecContours[i]->GetOutput());
}
pCluster->EndAppend();
pCluster->Update();

According to the docu this should do perfectly well. What happens is this: the call "pCluster->EndAppend()" crashes. I stepped into the code and discovered that vtkQuadricClustering::EndAppendVertexGeometry(vtkPolyData *input) is called with a NULL pointer in "input", which makes sense since the input pointer of pCluster is never set. From the code of "EndAppendVertexGeometry" I see that there is a complete traversal of the input vertices, which in this case, so I assume, should contain all vertices of all appended inputs. But even if I specified the input the traversal would be done only for the first input's vertices. Is this a problem or just a major mistake/misassumption on my part?

Greetings,
	Bernd
	




More information about the vtkusers mailing list