@urban-toolkit/autk-core / buildTransferContext
Function: buildTransferContext()
buildTransferContext(
values,config?):TransferContext
Defined in: transfer-function.ts:91
Builds a transfer-function context from valid scalar values.
The returned context caches dataset bounds and the resolved configuration so repeated alpha evaluation does not need to recompute them. When values is empty, the context is zeroed and validCount is 0; callers can still use it for evaluation, but the output will fall back to the configured opacity range for the selected mode.
Parameters
values
number[]
Valid scalar values used to derive dataset statistics.
config?
Optional transfer-function overrides applied on top of defaults.
Returns
Precomputed transfer-function context for repeated alpha evaluation.
Throws
Never throws. Empty input produces a zeroed context.
Example
const ctx = buildTransferContext([0.1, 0.5, 0.3, 0.9], { mode: 'linear' });
// ctx.min → 0.1, ctx.max → 0.9, ctx.config.mode → 'linear'