Skip to main content

Function: cellPoints()

cellPoints(shape, size): [number, number][]

Defined in: packages/sdvplot/src/bins/squarebin.ts:133

A cell's vertices around (0, 0), in the points' units: a hexagon of circumradius size (d3-hexbin's vertex order) or a square of side size. Add a bin's centre to each to outline that cell as a polygon.

Parameters​

shape​

BinShape

size​

number

Returns​

[number, number][]

Example​

import { cellPoints } from "@sportsdataverse/sdvplot/bins";

cellPoints("square", 10); // [[-5, -5], [5, -5], [5, 5], [-5, 5]]