src/colors/lookupTable.js
function linearIndexLookupMain (v, p) {
  let dIndex;

  // NOTE: Added Math.floor since values were not integers? Check VTK source
  if (v < p.Range[0]) {
    dIndex = p.MaxIndex + BELOW_RANGE_COLOR_INDEX + 1.5;
  } else if (v > p.Range[1]) {
    dIndex = p.MaxIndex + ABOVE_RANGE_COLOR_INDEX + 1.5;
  } else {
    dIndex = (v + p.Shift) * p.Scale;
  }

  return Math.floor(dIndex);
}
function linearIndexLookupMain (v, p) {
  let dIndex;

  // NOTE: Added Math.floor since values were not integers? Check VTK source
  if (v < p.Range[0]) {
    dIndex = p.MaxIndex + BELOW_RANGE_COLOR_INDEX + 1.5;
  } else if (v > p.Range[1]) {
    dIndex = p.MaxIndex + ABOVE_RANGE_COLOR_INDEX + 1.5;
  } else {
    dIndex = (v + p.Shift) * p.Scale;
  }

  return Math.floor(dIndex);
}
function linearIndexLookupMain ( v , p ) { let dIndex ; // NOTE: Added Math.floor since values were not integers? Check VTK source if ( v < p . Range [ 0 ] ) { dIndex = p . MaxIndex + BELOW_RANGE_COLOR_INDEX + 1.5 ; } else if ( v > p . Range [ 1 ] ) { dIndex = p . MaxIndex + ABOVE_RANGE_COLOR_INDEX + 1.5 ; } else { dIndex = ( v + p . Shift ) * p . Scale ; } return Math . floor ( dIndex ) ; }
Maps a value to an index in the table
@param {Number} v A double value which table index will be returned.
@param {any} p An object that contains the Table "Range", the table "MaxIndex",
A "Shift" from first value in the table and the table "Scale" value
@returns {Number} The mapped index in the table
@memberof Colors
Maps a value to an index in the table