[vtkusers] RE: vtkMergeCells/corrupt k-d tree

Katie Grayshan kgrayshan at hotmail.com
Thu Jun 29 10:11:02 EDT 2006


To follow-up:
I have found that the program works if you turn the MergeDuplicatePoints mode off; however, the resulting contours are disconnected. Aside from the small set of n for which the program fails when MergeDuplicatePoints is on, it produces smooth, connected contours which I want. I would prefer to keep this feature 'on' for this reason, but I also need the program to work for all n. 
 
Why does turning the MergeDuplicatePoints on cause a corrupt vtkKdTree?
 
Thanks for your suggestions in advance.
Katelyn Grayshan
 
> " ERROR: vtkKdTree:: BuildMapForDuplicatePoints corrupt k-d tree"
> import Numeric as N
> import vtk
> 
> n = 16> 
> a = -1. + ( 2. /( n-1.0 ) )*N.arange( 0, n )
> A = N.multiply.outer( N.ones( ( n, ), typecode = N.Float64 ), a )
> B = N.multiply.outer( a, N.ones( ( n, ), typecode = N.Float64 ) )
> C = N.array( [ [ 1. ]*n ]*n )
> 
> R = N.sqrt( A**2 + B**2 + C**2 )
> x, y, z = ( A/R, B/R, C/R )
>//cut//
> vtk_SGrid = vtk.vtkStructuredGrid( )
> vtk_SGrid.SetDimensions( n, n, 1 )
> vtk_SGrid.SetPoints( vtk_pts )
> vtk_SGrid.GetPointData( ).SetScalars( vtk_z )
>//cut//
> vtk_USGrid = vtk.vtkUnstructuredGrid( )

> vtk_merge = vtk.vtkMergeCells( )
> vtk_merge.SetUnstructuredGrid( vtk_USGrid ) 
> vtk_merge.PointMergeTolerance = 10e-4
> vtk_merge.MergeDuplicatePointsOn( )
> vtk_merge.SetTotalNumberOfPoints( n**2 )
> vtk_merge.SetTotalNumberOfCells( ( n-1 )**2 )
> vtk_merge.SetTotalNumberOfDataSets( 1 )

****FAILS HERE if MergeDuplicatePoints is On*****************
> vtk_merge.MergeDataSet( vtk_SGrid )
> vtk_merge.Finish( )
> //cut//
>/////See Previous Email for full code//////
_________________________________________________________________
Try Live.com: where your online world comes together - with news, sports, weather, and much more.
http://www.live.com/getstarted


More information about the vtkusers mailing list