[vtk-developers] Speeding up raycasting on x86

David Gobbi dgobbi at imaging.robarts.ca
Fri Jul 12 11:46:40 EDT 2002


Hi Lisa,

I've converted the vtkFloorFuncMacro() to Chris' version.
His version is indeed safe, there is no 1/65536 error in it,
and it is more efficient than my version.

There are still plenty of (int) casts left in the ray casting
code i.e. all the conversions of float scalar values to int,
and if these were converted to use vtkRoundFuncMacro() there
is probably a few more % of efficiency to be gained.

I don't really like the fact that VTK always converts float scalars
to int scalars using 'cast' operations.  It seems to me that it really
should be rounding instead.

 - David


On Thu, 11 Jul 2002, Volpe, Christopher R (Research) wrote:

>
>
> > -----Original Message-----
> > From: Lisa Avila [mailto:lisa.avila at kitware.com]
> > Sent: Thursday, July 11, 2002 5:06 PM
> > To: Volpe, Christopher R (Research); 'David Gobbi'; Lisa Avila
> > Cc: vtk-developers at public.kitware.com
> > Subject: RE: [vtk-developers] Speeding up raycasting on x86
> >
> >
> >
> >
> >
> > >2) It's not completely correct. Tests I ran not too long ago
> > show that the
> > >process causes the value
> > >to be *rounded*, but this is not readily apparent because
> > the rounding is,
> > >in this case, not to the
> > >nearest int but to the nearest fraction of 1/2**16. So, for
> > example, a
> > >value greater than (3.0 -
> > >1/2**16), but less than 3.0,  will be rounded up to 3. This problem
> > >becomes very readily apparent if
> > >you tweak the values so that you use the full 32 bits for
> > the integer
> > >portion and don't reserve any
> > >bits for fixed point fractional values, thus causing rounding to the
> > >nearest integer.
> >
> > Being "not completely correct" may cause big problems in the
> > ray caster.
>
> Yes, butit's easily fixable. My version, for example, doesn't have the problem.
>
> -Chris
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtk-developers
>




More information about the vtk-developers mailing list