Calculates the cross product of two vectors.
The cross product is a vector that points straight out of the plane created by two vectors. The cross product's magnitude is the area of the parallelogram formed by the original two vectors.
The static version of cross()
, as in p5.Vector.cross(v1, v2)
, is the same as calling v1.cross(v2)
.
Examples
Syntax
cross(v)
cross(v1, v2)
Parameters
v
p5.Vector:
p5.Vector to be crossed.
v1
p5.Vector:
first p5.Vector.
v2
p5.Vector:
second p5.Vector.
Returns
p5.Vector: cross product as a 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!