[vtkusers] Bug in vtkMergePoints when cutting a wedge

Thomas Demachy thomas at mcube.fr
Fri Jun 16 12:11:58 EDT 2000


Hello all !

I discovered a bug when using a vtkCutter filter on wedges. Here is my
analysis for this problem, and I wanted to submit it to you. So, has anybody
already seen this one, or am I going the wrong way for the solution ?

Ok, here it goes :

How to reproduce
To reproduce, you can use the attached source Wedges.cxx
It builds a beam out of several wedges and then create a cut plane using a
vtkcutter filter and a vtkPlane function. The bug does not happen for every
cut plane values. (origin + normal)

These values works :
origin : 0 0 0
normal : 1 0 0

this does not :
origin : 0 0 0
normal : .26 .53 .80

to test it, the Wedges application ask for these values at the beginning of
the execution.

When debugging, the program crashes in vtkMergePoints::IsInsertedPoint.

 It is reproductible, because I created Wedges.cxx just to be sure that it
was a VTK bug and not my own application's one.

Analysis
vtkCutter::Execute calls (line 269) vtkWedge::Contour, which computes points
coordinates and calls (line 438) vtkMergePoints::IsInsertedPoint, with this
calculated point.

This last function tries to compute an index to lookup in an hash table
(line 83) and find a "bucket", but the index is way out (in my example, it
is -18000 something). This is because the point coordinates given by the
vtkWedge::Countour is out of the dataset bounds.

Solutions
One solution would be to check each time in vtkMergePoints::IsInsertedPoint
that the idx index is in a valid range (0->number of buckets). Another one
would be making sure that vtkWedge::Countour does not call the above with an
out-of-bounds point.

I would be thankful if you could give it a look

Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wedges.cxx
Type: application/octet-stream
Size: 3940 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20000616/139c583f/attachment-0001.obj>


More information about the vtkusers mailing list