computeKdeGrid()
function computeKdeGrid<T>(layer, dimensions): KdeGrid;Defined in: packages/core/src/kde/density.ts:65
Estimates a smooth density surface from point data via a 2D Gaussian
kernel density estimate, sampled on a resolution x resolution grid
over the pitch — mplsoccer's kdeplot. Unlike computeHeatmapBins,
which is a hard histogram, each point spreads influence over its
neighbourhood, so the result reads as a continuous surface rather than
a grid of cells.
Pure and framework-agnostic (no pixels, no colour) like every other
binning function here; render/canvas/paint-kde.ts turns the grid into
pixels.
The kernel is axis-aligned with a per-axis bandwidth, defaulting to
Silverman's rule (see silvermanBandwidth) so a caller gets a sensible
surface without tuning; bandwidth overrides both axes when the data's
own spread isn't the right smoothing scale (e.g. a handful of points).
Values are densities, not probabilities — they're only ever consumed
relative to maxValue, so the normalising constant is omitted.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
layer | KdeLayer<T> |
dimensions | PitchDimensions |