rotate method

Matrix3 rotate(
  1. double theta
)

Rotates this matrix by the given theta (in radians).

Implementation

Matrix3 rotate(double theta) {
  final c = math.cos(theta);
  final s = math.sin(theta);

  final te = storage;

  final a11 = te[0], a12 = te[3], a13 = te[6];
  final a21 = te[1], a22 = te[4], a23 = te[7];

  te[0] = c * a11 + s * a21;
  te[3] = c * a12 + s * a22;
  te[6] = c * a13 + s * a23;

  te[1] = -s * a11 + c * a21;
  te[4] = -s * a12 + c * a22;
  te[7] = -s * a13 + c * a23;

  return this;
}