seaAround関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { seaAround } from "@johnmorrisdotca/chizu";
定義
function seaAround(x: number, y: number, reach: number, ring: MapRing): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
x | number | The horizontal native map coordinate. |
y | number | The vertical native map coordinate. |
reach | number | The maximum native map-unit search distance. |
ring | MapRing | A closed outline ring in native map units. |
戻り値
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.
例
import { parseMapRings, seaAround } from "@johnmorrisdotca/chizu";
const [square] = parseMapRings("M0,0L10,0L10,10L0,10Z");
console.log(seaAround(16, 5, 10, square!));
// 66出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。