rotation function

List<num> rotation(
  1. num angleInRadians
)

Creates a 2D rotation matrix angleInRadians amount to rotate in radians

Implementation

List<num> rotation(num angleInRadians) {
  var c = cos(angleInRadians);
  var s = sin(angleInRadians);
  return [
    c, -s, 0,
    s, c, 0,
    0, 0, 1,
  ];
}