[vtkusers] vtkOBBTree problem (vtkMath::Jacobi: Error extracting eigenfunctions)

Alex Malyushytskyy alexmalvtk at gmail.com
Tue Aug 16 22:51:17 EDT 2011


vtkOBBTree is using vtkMath (vtkJacobiN function) when building locator,
which fails on very simple polydata read from the following stl file.
There is some Qt classes usage in the code below (mostly string handling),
but I hope this will not hide the problem.

Any idea why and what is wrong?

Regards,
     Alex


// stl data file:

solid ascii
  facet normal 0. 0. 1.
    outer loop
      vertex 0.00094e+006 1. 340.981
      vertex 0.00099e+006 1. 340.981
      vertex 0.00091e+006 1. 340.981

    endloop
  endfacet
  facet normal 0. 0. 1.
    outer loop
      vertex 0.00094e+006 1. 330.981
      vertex 0.00099e+006 1. 330.981
      vertex 0.00091e+006 1. 330.981
    endloop
  endfacet
endsolid


// to reproduce read polydata, then build vtkOBBTree
// Basically this is polydata
QString fileName =...;// set file name

vtkPolyData* poly = stlModifier::createPolyDataFromStlFile( fileName );

vtkSmartPointer<vtkOBBTree> tree = vtkSmartPointer<vtkOBBTree>::New();
tree->SetDataSet( poly );
tree->BuildLocator();

// function which reads polydata
// I don't think it is needed to reproduce the brlem, but just in case

vtkPolyData* stlModifier::createPolyDataFromStlFile( const QString& fileName )
{
	vtkPolyData* poly = NULL;
	Q_ASSERT( !fileName.isEmpty() );

	if( ! fileName.isEmpty() )
	{
		QByteArray byteArray = QFile::encodeName ( fileName );

		vtkSmartPointer<vtkSTLReader> sr = vtkSmartPointer<vtkSTLReader>::New();
		sr->SetFileName( byteArray.data() );

        vtkSmartPointer<vtkGeometryFilter> filter =
vtkSmartPointer<vtkGeometryFilter>::New();
		filter->SetInputConnection( sr->GetOutputPort( ) );
		filter->Update();

        vtkSmartPointer<vtkCleanPolyData> cleanFilter =
vtkSmartPointer<vtkCleanPolyData>::New();
		cleanFilter->SetInputConnection( filter->GetOutputPort( ) );
		cleanFilter->PointMergingOn ();

        vtkSmartPointer<vtkTriangleFilter> triangleFilter =
vtkSmartPointer<vtkTriangleFilter>::New();
		triangleFilter->SetInputConnection( cleanFilter->GetOutputPort( ) );
		triangleFilter->PassLinesOff ();
		triangleFilter->PassVertsOff ();
		triangleFilter->Update();

		// make poly forget about the way it was created and release all the
vtkObjects
		poly = triangleFilter->GetOutput();
		poly->Register(NULL);
		poly->SetSource(NULL);

#ifdef DEBUG_POLY_DATA_MEMORY_LEAKS
		poly->DebugOn();
#endif
	}

	return poly;
}


Reading the following stl file to the



More information about the vtkusers mailing list