Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

seaAroundfunction

How much water is around a point before this ring's land, never looking further than reach - a place far from every coast only has to be known to be far, and walking six thousand points to find out how far is the bill this runs up on every draw.

Import it

import { seaAround } from "@johnmorrisdotca/chizu";

Definition

function seaAround(x: number, y: number, reach: number, ring: MapRing): number

Parameters

NameTypeDescription
xnumber

The horizontal native map coordinate.

ynumber

The vertical native map coordinate.

reachnumber

The maximum native map-unit search distance.

ringMapRing

A closed outline ring in native map units.

Returns

number

How much water is around a point before this ring's land, never looking further than reach - a place far from every coast only has to be known to be far, and walking six thousand points to find out how far is the bill this runs up on every draw.

Examples

import { parseMapRings, seaAround } from "@johnmorrisdotca/chizu";

const [square] = parseMapRings("M0,0L10,0L10,10L0,10Z");
console.log(seaAround(16, 5, 10, square!));
// 6
6

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.