Class: LerpVectorLookupTable
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:28
A linearly interpolated N-dimensional lookup table of vectors.
Constructors
Constructor
new LerpVectorLookupTable(
dimensionCount
,vectorLength
):LerpVectorLookupTable
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:57
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. |
vectorLength | number | The length of the interpolated vectors (i.e. the number of components in each vector) in the new table. Values less than 0 will be clamped to 0. |
Returns
LerpVectorLookupTable
Constructor
new LerpVectorLookupTable(
breakpoints
):LerpVectorLookupTable
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:68
Creates a lookup table initialized with an array of breakpoints.
Parameters
Parameter | Type | Description |
---|---|---|
breakpoints | readonly readonly [Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >>, number ][] | An array of breakpoints with which to initialize the new table. Each breakpoint should be expressed as an array, where the first element represents the breakpoint vector, 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. Additionally, the table's vector length will be set to the length of the shortest breakpoint vector. |
Returns
LerpVectorLookupTable
Accessors
dimensionCount
Get Signature
get dimensionCount():
number
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:36
The number of dimensions in this table.
Returns
number
vectorLength
Get Signature
get vectorLength():
number
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:43
The length of the vectors in this table.
Returns
number
Methods
get()
get(
out
, ...key
):Float64Array
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:159
Looks up a vector in this table using a specified key. The returned vector 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 |
---|---|---|
out | Float64Array | The vector to which to write the result. |
...key | number [] | The lookup key, as an ordered N-tuple of numbers. |
Returns
Float64Array
The vector corresponding to the specified key.
Throws
Error if this table has zero dimensions, the key has fewer dimensions than this table, or a vector could not be retrieved.
insertBreakpoint()
insertBreakpoint(
breakpoint
):this
Defined in: src/sdk/utils/datastructures/LerpVectorLookupTable.ts:106
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 [Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >>, 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, the breakpoint has fewer dimensions than this table, or the the length of the breakpoint vector is less than this table's vector length property.