distanceSquared関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The squared distance between two points, which needs no square root.
インポート
import { distanceSquared } from "@johnmorrisdotca/karakuri/physics";
定義
function distanceSquared(ax: number, ay: number, bx: number, by: number): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
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
The squared distance between two points, which needs no square root.
例
import { distanceSquared } from "@johnmorrisdotca/karakuri/physics";
console.log(distanceSquared(0,0,3,4));25出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。