Open eino opened 2 years ago
@martinken what do you think?
I definitely see the motivation but that can easily be handled at the application layer. So I'm not sure if it is a logic we want to add to the mapper or not. My concern is mainly to keep VTK/C++ behavior as close as vtk.js. But maybe that is something we want for both. I'm not sure.
Hi,
Need
I use vtk.js to map multiple values on a polydata, while allowing the user to switch visualized value. For now
setScalarRange
needs to be called manually, and so I need to keep track of the range of every visualizable data (including each component of vector arrays). I was thinking it would be really convenient if the Mapper could auto-detect the data range according to the current data.Feature
The auto-detection by the mapper according to the current scalars array could be done in
mapScalars()
, after thescalars
have been computed. Basically, it could be a simple ,model.scalarRange = scalars.getRange(model.fieldDataTupleId);
. To let the user override this range, the code could leavemodel.scalarRange
untouched and only use detected range if the user didn't provide a scalarRange. I started on this in this commit. What do you think?The drawback of leaving
model.scalarRange
untouched is that the calling code can't callmapper.getScalarRange()
to get the detected range.