Reference 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.

Examples

Syntax

reflect(surfaceNormal)

Parameters

surfaceNormal
p5.Vector: p5.Vector to reflect about.

Related References