p5.Vector
Table of Contents
- Methods
- Static Methods
Methods
isParallel
(
Boolean
-
v2
-
tolerance
Ask whether a vector is parallel to this one.
Parameters:
-
v2
p5.Vector -
[tolerance]
Number optional- margin of error for comparisons, comes into play when comparing rotated vectors. For example, we want <1, 0> to be parallel to <0, 1>.rot(Math.PI/2) but float imprecision can get in the way of that.
Returns:
Boolean
Transforms this vector by a 2D transformation matrix.
Parameters:
-
transform
p5.Transform2D
Returns:
p5.Vector:
this, after the change
Static Methods
Projects a vector onto the line parallel to a second vector, giving a third vector which is the orthogonal projection of that vector onto the line.
Parameters:
Returns:
p5.Vector:
projection of a onto the line parallel to b.
Applies a 2D transformation matrix (using homogeneous coordinates, so 3x3) to a Vector2 (<x, y, 1>) and returns a new vector2.
Parameters:
Returns:
p5.Vector:
a new vector