Reference · Framing, geometry and quiz tools
CalloutPlacetype
One place a circle could sit, and where it sits on the search grid.
The row and column are carried rather than recovered, so asking whether a place is too near a circle already put down is a look at the handful of cells around it instead of a walk through every circle on the map.
Import it
import type { CalloutPlace } from "@johnmorrisdotca/chizu";
Definition
type CalloutPlace = {
x: number;
y: number;
row: number;
col: number;
sea: number;
};
Members
| Name | Type | Description |
|---|---|---|
x | number | |
y | number | |
row | number | |
col | number | |
sea | number | Water between the circle's edge and the nearest land, in radii, up to |
Examples
import { calloutSpaces, type CalloutPlace } from "@johnmorrisdotca/chizu";
const [first]: CalloutPlace[] = calloutSpaces(4, { x: 0, y: 0, width: 100, height: 100 }, { bottom: 0, right: 0 }, []);
console.log(typeof first!.x, typeof first!.sea);
// number numbernumber numberWhat it prints (run when this page was built)