Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Used to rotate a normalized vector around a get point.
- * @param double n Containing the rotation amount
- * @return vector Containing the rotated form
- */
- rotate: function (n) {
- var
- // Normalise the vector
- v = this.normalize(),
- // Find the angle
- ca = Math.cos(n),
- sa = Math.sin(n),
- // And translate the position.
- xx = v.getX() * ca - v.getY() * sa,
- yy = v.getX() * sa + v.getY() * ca;
- return vector2(xx, yy);
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement