Dot Product

The dot product operation (·) calculates the degree of similarity of a vec2 pair based on their angles and lengths.

Calculated as ‖a‖‖b‖cos(θ), it represents the product of their lengths (‖a‖‖b‖) scaled by the alignment of their directions (cos(θ)). The output ranges from the positive to negative product of their lengths based on when they are pointing in the same or opposite directions. If either vec2 has zero length, the output is 0.

Interface

Inputs

ParameterDetailsPossible Types
Value

An operand of the dot product operation.

Primary Input

Vec2[]
Vec2
Other Value

The other operand of the dot product operation.

Default: 1., 0

Vec2[]
Vec2
Normalize

Whether to normalize both input vec2s so the calculation ranges in [-1, 1] by considering only their degree of directional alignment.

Default: false

bool[]
bool

Outputs

ProductDetailsPossible Types
Result

The value produced by the node operation.

Primary Output

f64
f64[]