reflect()

2Dの線または3Dの平面についてベクトルを反射させます。

線または平面の向きは、形状から離れる方向を指す法線ベクトルによって記述されます。

reflect()の静的バージョン(p5.Vector.reflect(v, n)のような形式)は、 新しいp5.Vectorオブジェクトを返し、 元のオブジェクトは変更しません。

実例

シンタックス

reflect(surfaceNormal)
reflect(incidentVector, surfaceNormal, [target])

パラメーター

surfaceNormal
p5.Vector:

反射の基準となるp5.Vector

incidentVector
p5.Vector:

反射させるベクトル。

target
p5.Vector:

結果を受け取るベクトル。

This page is generated from the comments in src/math/p5.Vector.js . Please feel free to edit it and submit a pull request!

関連するリファレンス