segmentMeetsRing関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether a straight line from one point to another passes over the land inside a ring.
インポート
import { segmentMeetsRing } from "@johnmorrisdotca/chizu";
定義
function segmentMeetsRing(ax: number, ay: number, bx: number, by: number, ring: MapRing): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
ax | number | The first segment endpoint’s horizontal map coordinate. |
ay | number | The first segment endpoint’s vertical map coordinate. |
bx | number | The second segment endpoint’s horizontal map coordinate. |
by | number | The second segment endpoint’s vertical map coordinate. |
ring | MapRing | A closed outline ring in native map units. |
戻り値
boolean
Whether a straight line from one point to another passes over the land inside a ring.
例
import { parseMapRings, segmentMeetsRing } from "@johnmorrisdotca/chizu";
const [square] = parseMapRings("M0,0L10,0L10,10L0,10Z");
console.log(segmentMeetsRing(-5, 5, 15, 5, square!), segmentMeetsRing(-5, 20, 15, 20, square!));
// true falsetrue false出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。