Reference · Framing, geometry and quiz tools
MapRingtype
One closed outline: a region's mainland, or one of its islands.
Import it
import type { MapRing } from "@johnmorrisdotca/chizu";
Definition
type MapRing = {
d: string;
points: readonly number[];
minX: number;
minY: number;
maxX: number;
maxY: number;
};
Members
| Name | Type | Description |
|---|---|---|
d | string | The ring as the path draws it, so a part of a region can be redrawn on its own. |
points | readonly number[] | |
minX | number | |
minY | number | |
maxX | number | |
maxY | number |
Examples
import { parseMapRings, type MapRing } from "@johnmorrisdotca/chizu";
const [ring]: MapRing[] = parseMapRings("M0,0L10,0L10,5L0,5Z");
console.log(ring!.minX, ring!.minY, ring!.maxX, ring!.maxY);
// 0 0 10 50 0 10 5What it prints (run when this page was built)