hextris/math.js
Noah Moroze 4646514de8 MATH
2014-05-17 10:43:16 -04:00

10 lines
No EOL
235 B
JavaScript

function rotatePoint(x, y, theta) {
var thetaRad = theta * 0.0174532925;
var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y;
var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y;
return {
x: rotX,
y: rotY,
};
}