Skip to content

BinMapper

Overview

BinMapper is an object that maps a continuous value to one of a finite number of "bins".

@author John Blanco (PhET Interactive Simulations)

Class BinMapper

import { BinMapper } from 'scenerystack/tambo';

Constructor

new BinMapper( valueRange : Range, numBins : number, providedOptions? : BinMapperOptions )

Instance Methods

mapToBin( value : number ) : number

Map the provided value to a bin.

Type BinMapperOptions

import type { BinMapperOptions } from 'scenerystack/tambo';
  • tolerateOutOfRangeValues?: boolean
    Allow values that are outside the specified range (if false, an assert occurs on out-of-range values).

Source Code

See the source for BinMapper.ts in the tambo repository.