rotateAround method

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

Implementation

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

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

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

  return this;
}