Exemplo n.º 1
0
        public static Rotation GetRotation(string direction)
        {
            var _instance = new Rotation();

            switch (direction)
            {
            case "N":
                return(_instance);

            case "E":
                return(_instance.AddDegree(90));

            case "S":
                return(_instance.AddDegree(180));

            case "W":
                return(_instance.AddDegree(270));

            default:
                throw new ArgumentException($"Invalid direction. {direction}");
            }
        }
Exemplo n.º 2
0
        public void Rotate(RotationDirection direction)
        {
            switch (direction)
            {
            case RotationDirection.L:
                _rotation = Rotation.AddDegree(-90);
                break;

            case RotationDirection.R:
                _rotation = Rotation.AddDegree(+90);
                break;

            default:
                throw new ArgumentOutOfRangeException("Invalid Rotation");
            }
        }