rotate method

dynamic rotate({
  1. double rot = pi * 2 / 3,
})

Implementation

rotate({double rot = pi * 2 / 3}) {
  for (var i = 0; i < coordinates.length; i++) {
    var coord = coordinates[i];
    var xRot = coord.x * cos(rot) + coord.y * sin(rot);
    var yRot = -coord.x * sin(rot) + coord.y * cos(rot);
    coordinates[i] = Coord(xRot, yRot);
  }
}