dotProduct static method
Computes the dot product of two 2D vectors.
Given the (x, y)
coordinates of four points, (x0, y0)
, (x1, y1)
,
(x2, y2)
, and (x3, y3)
, computes the dot product of the vector
(dx0, dy0)
and (dx1, dy1)
.
Implementation
@pragma("vm:prefer-inline")
static double dotProduct(
double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
) {
var dx0 = x1 - x0, dy0 = y1 - y0, dx1 = x3 - x2, dy1 = y3 - y2;
return dx0 * dx1 + dy0 * dy1;
}