PitchKit
API Reference@pitchkit/coreFunctions

computeFlowBins()

function computeFlowBins(
   vectors, 
   binsX, 
   binsY, 
   dimensions
): FlowBin[];

Defined in: packages/core/src/geometry/flow.ts:31

Bins vectors by start location into a binsX x binsY grid over the pitch (same cell math as heatmap/bins.ts's computeHeatmapBins, kept independent rather than shared — that helper sums a scalar weight per bin, this one averages an end-point vector, which doesn't fit the same single-accumulator shape). Each occupied bin becomes one arrow: from the bin's center to the mean of every vector's end point that landed there. Empty bins are omitted rather than returned with count: 0, since there's no "zero-length arrow" to draw for a flow diagram the way a heatmap still colors an empty cell.

Parameters

ParameterType
vectorsreadonly FlowVector[]
binsXnumber
binsYnumber
dimensionsPitchDimensions

Returns

FlowBin[]

On this page