hextris/js/math.js

15 lines
318 B
JavaScript
Raw Normal View History

2014-08-23 02:10:55 +00:00
function rotatePoint(x, y, theta) {
2015-05-24 14:54:12 +00:00
var thetaRad = theta * (Math.PI / 180);
var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y;
var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y;
2014-08-23 02:10:55 +00:00
2015-05-24 14:54:12 +00:00
return {
x: rotX,
y: rotY
};
2014-08-23 02:10:55 +00:00
}
function randInt(min, max) {
2015-05-24 14:54:12 +00:00
return Math.floor((Math.random() * max) + min);
2014-08-23 02:10:55 +00:00
}