fromRotation function

dynamic fromRotation(
  1. List<double> out,
  2. double rad
)

Creates a matrix from a given angle This is equivalent to (but much faster than):

mat2.identity(dest);
mat2.rotate(dest, dest, rad);

@param {mat2} out mat2 receiving operation result @param {Number} rad the angle to rotate the matrix by @returns {mat2} out

Implementation

fromRotation(List<double> out, double rad) {
  final s = math.sin(rad);
  final c = math.cos(rad);
  out[0] = c;
  out[1] = s;
  out[2] = -s;
  out[3] = c;
  return out;
}