svgAngle method
dynamic
svgAngle(
- dynamic ux,
- dynamic uy,
- dynamic vx,
- dynamic vy,
Implementation
svgAngle(ux, uy, vx, vy) {
var dot = ux * vx + uy * vy;
var len = Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);
var ang = Math.acos(Math.max(-1, Math.min(1, dot / len))); // floating point precision, slightly over values appear
if ((ux * vy - uy * vx) < 0) ang = -ang;
return ang;
}