rotatePoint static method

Offset rotatePoint(
  1. Offset point,
  2. double angle,
  3. Offset center
)

Implementation

static Offset rotatePoint(Offset point, double angle, Offset center) {
  final s = sin(angle);
  final c = cos(angle);

  double x1 = point.dx - center.dx;
  double y1 = point.dy - center.dy;

  double x2 = x1 * c - y1 * s;
  double y2 = x1 * s + y1 * c;

  return Offset(x2 + center.dx, y2 + center.dy);
}