Skip to content
pyautark (soon)

@urban-toolkit/autk-core


@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?

TransferFunction

Optional transfer-function overrides applied on top of defaults.

Returns

TransferContext

Precomputed transfer-function context for repeated alpha evaluation.

Throws

Never throws. Empty input produces a zeroed context.

Example

ts
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'

Released under the MIT License.