rotate static method

Matrix4 rotate(
  1. double angle,
  2. Offset focalPoint
)

Creates a rotation matrix centered at focalPoint

Implementation

static Matrix4 rotate(double angle, Offset focalPoint) {
  final c = cos(angle);
  final s = sin(angle);
  final dx = (1 - c) * focalPoint.dx + s * focalPoint.dy;
  final dy = (1 - c) * focalPoint.dy - s * focalPoint.dx;

  return Matrix4(c, s, 0, 0, -s, c, 0, 0, 0, 0, 1, 0, dx, dy, 0, 1);
}