リファレンス normalize()

normalize()

p5.Vectorオブジェクトのコンポーネントを スケーリングして、その大きさを1にします。

normalize()の静的バージョン、つまりp5.Vector.normalize(v)は、 新しいp5.Vectorオブジェクトを返し、 元のオブジェクトは変更しません。

実例

シンタックス

normalize()
normalize(v, [target])

パラメーター

v
p5.Vector:

正規化するベクトル

target
p5.Vector:

結果を受け取るベクトル

リターン

p5.Vector: 正規化されたp5.Vector
Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!

関連するリファレンス