rotateAround method

Vector2 rotateAround(
  1. Vector2 center,
  2. double angle
)

Implementation

Vector2 rotateAround(Vector2 center, double angle) {
  var c = Math.cos(angle), s = Math.sin(angle);

  var x = this.x - center.x;
  var y = this.y - center.y;

  this.x = x * c - y * s + center.x;
  this.y = x * s + y * c + center.y;

  return this;
}