[vtkusers] Problem using vtkMergePoints

Alex Malyushytskyy alexmalvtk at gmail.com
Fri Aug 28 23:23:00 EDT 2009


VTK documentation states that :

"vtkPointLocator has two distinct methods of interaction. In the first
method, you supply it with a dataset, and it operates on the points in
the dataset. In the second method, you supply it with an array of
points, and the object operates on the array."

I need the second method, because I require control over building
procedure and dealing with complex composite data structure which
should not be affected.
(I need to build the unique set of the points and the map which can
provide mapping from the unique point to the points  in vtkPolyData
(which don't have to be unique) in composite data set).

But could not find the way how it can be implemented.

I assumed that I can just use InsertPoint or InsertUniquePoint to
insert points, but
both functions rely on the vtkMergePoints::HashTable not to be NULL;

For example the following code

	vtkSmartPointer<vtkMergePoints> merge = vtkSmartPointer<vtkMergePoints>::New();
	
	double x0[3];
	x0[0]= 0.;
	x0[1]= 0.;
	x0[2]= 0.;

	merge->InsertPoint(0, x0);


will throw exception at vtkpointlocator.cxx, function InsertPoint line:
  if ( ! (bucket = this->HashTable[idx]) )

because HashTable == NULL


Do I miss something, and the vtkMergePoints has to be supplied by  the
point array in other way?
Attempts to call Initialize or Build on empty vtkMergePoints  did not help.
(MSVC 2005 SP2, WindowsXp 64 bit, VTK 5.4.2 stable, QT4.4.3 )

I probably could build map using STL or QHash instead ( it is pretty
straightforward, because I need to remove duplicate points only), but
it seems the natural to use VTK  methods.
If anybody could confirm that the way I was going to use it is legal,
I probably could create the patches, but until then I can only assume
I am missing the correct usage.

Any help is appreciated.

Regards,
    Alex



More information about the vtkusers mailing list