@thi.ng/vectors
Version:
Optimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts
12 lines (11 loc) • 300 B
JavaScript
import { setC2 } from "./setc.js";
const rotateAroundPoint2 = (out, v, p, theta) => {
const x = v[0] - p[0];
const y = v[1] - p[1];
const s = Math.sin(theta);
const c = Math.cos(theta);
return setC2(out || v, x * c - y * s + p[0], x * s + y * c + p[1]);
};
export {
rotateAroundPoint2
};