[vtk-developers] Bug in vtkColorTransferFunction

Randall Hand randall.hand at gmail.com
Thu Dec 1 14:19:06 EST 2005


I've spent the last week beating my head against the wall trying to figure
out why my colormap didn't work in my application, but smaller test cases
would work.  I finally figured it out just now.  (Filed as bug 2546)

When using a vtkColorTransferFunction, and adding a large number of points
(Over 100) in an out-of-order fashion (In my case, I'm reading them from a
file and the X's are fairly random, not simply incrementing), it will
destroy the colormap.  The problem comes when you add the 100'th point and
it tries to resize the colormap.  In this case, it uses a memcpy to copy the
colormap into the newly allocated (and large) array.  If that 100th's point
is not the highest point in the list, it uses 2 memcpy's, one shifted by one
entry to create a "hole" for the newly added entry in the middle.
Unfortunately, it indexes wrong! So the net result:  Blue becomes red, green
becomes blue, red becomes the next entry's X, and in general it's just all
b0rked.

Attached to the bug (
http://www.vtk.org/Bug/bug.php?op=show&bugid=2546&pos=3 ) you'll find a
test-case that uses a Mandelbrot fractal source to illustrate the problem.

--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20051201/c9dbeeae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cxx
Type: application/octet-stream
Size: 3543 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20051201/c9dbeeae/attachment-0001.obj>


More information about the vtk-developers mailing list