[vtk-developers] TestBunykRayCastFunction failure; invalid double > uint8 cast
David Gobbi
david.gobbi at gmail.com
Fri Mar 22 16:38:17 EDT 2013
Yeah, pretty much what Will says. Each loop increments a bit too much.
I suspect that the code has an off-by-one error right at line 242:
= (this->IntegrationTableScalarResolution-2)/(range[1]-range[0]);
This would make more sense if it was "-1" instead of "-2". There is a
similarly suspicious "-2" at line 183.
I've seen people intentionally fudge their ranges by 1 in order to
correct for the bias caused by truncation (e.g. in the cast-to-int).
For example, the developer might notice that the image is a bit darker
than it should be, so they fudge the range to make it brighter, when
the proper fix would have been to have replaced the truncation by
rounding. Maybe that's what is going on here.
- David
On Fri, Mar 22, 2013 at 1:59 PM, Will Schroeder
<will.schroeder at kitware.com> wrote:
> Based on the fact that the values are not integral and have a slight
> fractional component (which I bet was the expectation of the writer), the
> loop has not been properly set up with too much increment going on....but
> I'm saying this without looking at the code so what do I know :-)
> W
>
>
> On Fri, Mar 22, 2013 at 3:07 PM, Sean McBride <sean at rogue-research.com>
> wrote:
>>
>> Hi all,
>>
>> The "vtkRenderingVolumePython-TestBunykRayCastFunction" test fails
>> intermittently on Rogue11 so I ran it through the clang undefined behaviour
>> checker, and it detects that this test casts the double value 257.023810 to
>> 'unsigned char', which of course doesn't fit. Dunno if this is responsible
>> for the intermittent failure, but...
>>
>> In vtkUnstructuredGridPreIntegration.cxx line 293-294 there is a 'for'
>> loop that calls SetTuple1(0, foo) where 'foo' is too big on the last
>> iteration. I logged all values of foo:
>>
>> 0.000000
>> 2.023810
>> 4.047619
>> ...
>> 252.976190
>> 255.000000
>> 257.023810
>>
>> Maybe the loop executes once too many times? Anyone know this code?
>>
>> Thanks,
>>
>> --
>> ____________________________________________________________
>> Sean McBride, B. Eng sean at rogue-research.com
>> Rogue Research www.rogue-research.com
>> Mac Software Developer Montréal, Québec, Canada
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>
>
>
> --
> William J. Schroeder, PhD
> Kitware, Inc.
> 28 Corporate Drive
> Clifton Park, NY 12065
> will.schroeder at kitware.com
> http://www.kitware.com
> (518) 881-4902
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
More information about the vtk-developers
mailing list