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:

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

Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!

関連するリファレンス