distanceToSegment関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
How far (px, py) is from the segment a to b.
インポート
import { distanceToSegment } from "@johnmorrisdotca/karakuri/physics";
定義
function distanceToSegment(px: number, py: number, ax: number, ay: number, bx: number, by: number): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
px | number | The horizontal coordinate of the point to test. |
py | number | The vertical coordinate of the point to test. |
ax | number | The first segment endpoint’s horizontal coordinate. |
ay | number | The first segment endpoint’s vertical coordinate. |
bx | number | The second segment endpoint’s horizontal coordinate. |
by | number | The second segment endpoint’s vertical coordinate. |
戻り値
number
How far (px, py) is from the segment a to b.
例
import { distanceToSegment } from "@johnmorrisdotca/karakuri/physics";
console.log(distanceToSegment(3,4,0,0,10,0));4出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。