unit関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The unit vector of (x, y), or (0, 0) for a zero vector.
インポート
import { unit } from "@johnmorrisdotca/karakuri/physics";
定義
function unit(x: number, y: number): Vec
引数
| 名前 | 型 | 説明 |
|---|---|---|
x | number | The horizontal coordinate or vector component in native units. |
y | number | The vertical coordinate or vector component in native units. |
戻り値
Vec
The unit vector of (x, y), or (0, 0) for a zero vector.
例
import { unit } from "@johnmorrisdotca/karakuri/physics";
console.log(unit(3,4));{ x: 0.6, y: 0.8 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。