[vtk-developers] Why is GetRange double* even for non double arrays?

David Gobbi david.gobbi at gmail.com
Mon May 17 10:18:46 EDT 2010


On Mon, May 17, 2010 at 7:51 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>
> Ok. How does this look? If it's ok, care to commit it?

Take a look at ComputeScalarRange in vtkDataArrayTemplate.txx, it
should give you an idea of how this should be implemented.  For types
like "long long" that have higher precision than "double", it's
necessary to store the range directly into a "long long [2]" variable
in order to avoid losing precision.

The fact that the existing GetRange(double [2]) method can lose
precision for vtkIdTypeArray and vtkTypeInt64Array is in fact a very
strong argument that we need a typed GetValueRange() method.

   David



More information about the vtk-developers mailing list