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 any vector has zero length, the output is 0.

Interface

Inputs

ParameterDetailsPossible Types
Vector A

An operand of the dot product operation.

Primary Input

vec2
Vector B

The other operand of the dot product operation.

Default: 1., 0

vec2
Normalize

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

Default: false

bool

Outputs

ProductDetailsPossible Types
Result

The value produced by the node operation.

Primary Output

f64