segmentsIntersect関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether the segments a1 to a2 and b1 to b2 cross or touch.
インポート
import { segmentsIntersect } from "@johnmorrisdotca/karakuri/physics";
定義
function segmentsIntersect(a1x: number, a1y: number, a2x: number, a2y: number, b1x: number, b1y: number, b2x: number, b2y: number): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
a1x | number | The first segment’s starting horizontal coordinate. |
a1y | number | The first segment’s starting vertical coordinate. |
a2x | number | The first segment’s ending horizontal coordinate. |
a2y | number | The first segment’s ending vertical coordinate. |
b1x | number | The other segment’s starting horizontal coordinate. |
b1y | number | The other segment’s starting vertical coordinate. |
b2x | number | The other segment’s ending horizontal coordinate. |
b2y | number | The other segment’s ending vertical coordinate. |
戻り値
boolean
Whether the segments a1 to a2 and b1 to b2 cross or touch.
例
import { segmentsIntersect } from "@johnmorrisdotca/karakuri/physics";
console.log(segmentsIntersect(0,0,10,10,0,10,10,0));true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。