Calculates the dot product of two vectors.
The dot product is a number that describes the overlap between two vectors. Visually, the dot product can be thought of as the "shadow" one vector casts on another. The dot product's magnitude is largest when two vectors point in the same or opposite directions. Its magnitude is 0 when two vectors form a right angle.
The version of dot()
with one parameter interprets it as another p5.Vector object.
The version of dot()
with multiple parameters interprets them as the x
, y
, and z
components of another vector.
The static version of dot()
, as in p5.Vector.dot(v1, v2)
, is the same as calling v1.dot(v2)
.
Examples
Syntax
dot(x, [y], [z])
dot(v)
dot()
dot(v1, v2)
Parameters
Returns
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.