Class: LerpLookupTable
Defined in: src/sdk/utils/datastructures/LerpLookupTable.ts:21
A linearly interpolated N-dimensional lookup table.
Constructors
Constructor
new LerpLookupTable(
dimensionCount
):LerpLookupTable
Defined in: src/sdk/utils/datastructures/LerpLookupTable.ts:39
Creates a lookup table of a specified dimension.
Parameters
Parameter | Type | Description |
---|---|---|
dimensionCount | number | The number of dimensions in the new table. Values less than 0 will be clamped to 0. |
Returns
LerpLookupTable
Constructor
new LerpLookupTable(
breakpoints
):LerpLookupTable
Defined in: src/sdk/utils/datastructures/LerpLookupTable.ts:49
Creates a lookup table initialized with an array of breakpoints.
Parameters
Parameter | Type | Description |
---|---|---|
breakpoints | readonly readonly number [][] | An array of breakpoints with which to initialize the new table. Each breakpoint should be expressed as a number array, where the first element represents the breakpoint value, and the next N elements represent the breakpoint key in each dimension. If not all breakpoint arrays have the same length, the dimension of the table will be set equal to L - 1 , where L is the length of the shortest array. For arrays with length greater than L , all keys after index L - 1 will be ignored. If the table ends up with zero dimensions, it will be initialized to an empty table. |
Returns
LerpLookupTable
Accessors
dimensionCount
Get Signature
get dimensionCount():
number
Defined in: src/sdk/utils/datastructures/LerpLookupTable.ts:29
The number of dimensions in this table.
Returns
number
Methods
get()
get(...
key
):number
Defined in: src/sdk/utils/datastructures/LerpLookupTable.ts:125
Looks up a value in this table using a specified key. The returned value will be linearly interpolated from surrounding breakpoints if the key is not an exact match for any of the table's breakpoints.
Parameters
Parameter | Type | Description |
---|---|---|
...key | number [] | The lookup key, as an ordered N-tuple of numbers. |
Returns
number
The value corresponding to the specified key.
Throws
Error if this table has zero dimensions, the key has fewer dimensions than this table, or a value could not be retrieved.
insertBreakpoint()
insertBreakpoint(
breakpoint
):this
Defined in: src/sdk/utils/datastructures/LerpLookupTable.ts:77
Inserts a breakpoint into this table. If the breakpoint has more dimensions than this table, only the first N
keys of the breakpoint will be used, where N
is the dimension count of this table.
Parameters
Parameter | Type | Description |
---|---|---|
breakpoint | readonly number [] | A breakpoint, as a number array with the value at index 0 followed by the keys for each dimension. |
Returns
this
This table, after the breakpoint has been inserted.
Throws
Error if this table has zero dimensions, or the breakpoint has fewer dimensions than this table.