[vtkusers] Minor bug fix for vtkImageCanvasSource2D

John Tourtellott johnt at raytechcomputing.com
Mon Feb 26 19:05:24 EST 2001


I found that the vtkImageCanvasSource2D::FillTriangle() method creates
the wrong image in one of my applications. The specific call was:

   canvas->FillTriangle( 128, 128, 11, 177, 1, 128 );

I believe that the problem occurs whenever the y coordinate of the first
and third points are the same and less than the y coordinate of the
second point. I was able to fix the problem in
vtkImageCanvasSource2D.cxx by changing line 379 from:

  if((b1 < c1 && c1 < a1) || (b1 > c1 && c1 > a1))

to:

  if((b1 < c1 && c1 < a1) || (b1 > c1 && c1 >= a1))
                                             ^

I'd appreciate if one of the authors would check into this and, if
needed, update the repository.

--john






More information about the vtkusers mailing list