rotateOffset function

Offset rotateOffset(
  1. Offset input,
  2. Offset center,
  3. double angle
)

Implementation

Offset rotateOffset(Offset input, Offset center, double angle) {
  final double x = input.dx;
  final double y = input.dy;
  final double rx0 = center.dx;
  final double ry0 = center.dy;
  final double x0 = (x - rx0) * cos(angle) - (y - ry0) * sin(angle) + rx0;
  final double y0 = (x - rx0) * sin(angle) + (y - ry0) * cos(angle) + ry0;
  return Offset(x0, y0);
}