레퍼런스 reflect()

reflect()

Reflects a vector about a line in 2D or a plane in 3D.

The orientation of the line or plane is described by a normal vector that points away from the shape.

The static version of reflect(), as in p5.Vector.reflect(v, n), returns a new p5.Vector object and doesn't change the original.

예제

구문

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

매개변수

surfaceNormal
p5.Vector:

p5.Vector to reflect about.

incidentVector
p5.Vector:

vector to be reflected.

target
p5.Vector:

vector to receive the result.

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

관련 레퍼런스