vectorAngle function
Implementation
double vectorAngle(double ux, double uy, double vx, double vy) {
var sign = ux * vy - uy * vx < 0 ? -1 : 1;
var ua = sqrt(ux * ux + uy * uy);
var va = sqrt(vx * vx + vy * vy);
var dot = ux * vx + uy * vy;
return sign * acos(clip(dot / (ua * va), -1, 1));
}