public static Direction2H ToDirection2H(this Direction4 direction) { if (direction.IsVertical()) { throw new Exception("Passed vertical direction4 in place of horizontal"); } return(direction == Direction4.Left ? Direction2H.Left : Direction2H.Right); }