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!