rotate method

Matrix rotate()

Implementation

Matrix rotate() {
  var newMtx = Matrix();
  s.asMap().forEach((y, row) {
    row.asMap().forEach((x, cell) {
      newMtx.put(y, x, cell);
    });
  });
  newMtx.orientation = orientation == MatrixOrientation.Horizontal
      ? MatrixOrientation.Vertical
      : MatrixOrientation.Horizontal;
  return newMtx;
}