Dot_product_normalised - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

Description

DotProduct.png In mathematics, the dot product, or scalar product (or sometimes inner product in the context of Euclidean space), is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors) and returns a single number. This operation can be defined either algebraically or geometrically. Algebraically, it is the sum of the products of the corresponding entries of the two sequences of numbers. Geometrically, it is the product of the magnitudes of the two vectors and the cosine of the angle between them. The name "dot product" is derived from the centered dot " ยท " that is often used to designate this operation; the alternative name "scalar product" emphasizes the scalar (rather than vectorial) nature of the result.

This function normalises the calculation so the value returned lies between -1 and 1.

Parameters

Parameter Data Type Description
x1 double x coordinate of the first point
y1 double y coordinate
x2 double x coordinate of the second point
y2 double y coordinate

Return Values

double: Returns the normalised dot product of two points.

Example Call

// demonstrates calculating the dot product of two points
dot_product_normalised(0, 0, 0, 0);

NOTOC

Category:Function:Real