mirror of
https://github.com/patriciogonzalezvivo/thebookofshaders
synced 2024-11-03 23:15:23 +00:00
828 B
828 B
Dot
Calculate the dot product of two vectors
Declaration
float dot(float x, float y)
float dot(vec2 x, vec2 y)
float dot(vec3 x, vec3 y)
float dot(vec4 x, vec4 y)
Parameters
x
specifies the first of two vectors
y
specifies the second of two vectors
Description
dot()
returns the dot product of two vectors, x
and y
. i.e., x[0]⋅y[0]+x[1]⋅y[1]+...
If x
and y
are the same the square root of the dot product is equivalent to the length of the vector. The input parameters can be floating scalars or float vectors. In case of floating scalars the dot function is trivial and returns the product of x and y.