rotate static method

List<Color> rotate(
  1. List<Color> definition,
  2. Rotation rotation
)

Applies the rotation to a Cube definition colors.

Implementation

static List<Color> rotate(
  List<Color> definition,
  Rotation rotation,
) {
  final axis = rotation.axis;
  final n = rotation.n;

  for (var i = 1; i <= n; i++) {
    if (axis == Axis.x) {
      definition = _rotateX(definition);
    } else if (axis == Axis.y) {
      definition = _rotateY(definition);
    } else {
      definition = _rotateZ(definition);
    }
  }

  return definition;
}