Kitware / vtk-js

Visualization Toolkit for the Web
https://kitware.github.io/vtk-js/
BSD 3-Clause "New" or "Revised" License
1.23k stars 371 forks source link

[Bug] Wrong data range when array contains NaN values #2920

Closed FedericoNegri closed 1 year ago

FedericoNegri commented 1 year ago

Bug description

Trying to visualize this VTP file containing a data array on a mesh: array_with_nans.zip

The array "contact pressure;32" contains a lot of NaN values (as expected) and can be visualized correctly in Paraview (note the range [0, 1.6E+9]) image

With vtkjs, when I query the range with data.getRange() I get [NaN, NaN].

Steps to reproduce

You could for instance open the file attached above in Glance and notice these errors image

Detailed Behavior

I noticed this doesn't happen for arrays with NaN values in general. I think it only happens for those with NaN as first value (like in my case), maybe because of the min/max initialization in fastComputeRange? https://github.com/Kitware/vtk-js/blob/9af4da13a961ce671a40343ec77376e61a55d67c/Sources/Common/Core/DataArray/index.js#L24

Expected Behavior

The returned range should be [0, 1626058368].

Environment

finetjul commented 1 year ago

Thanks for your detailed report.

Can you please contribute a PullRequest to fix the error ?

FedericoNegri commented 1 year ago

@finetjul there you go https://github.com/Kitware/vtk-js/pull/2921

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 28.11.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: