Exemple #1
0
 public Point <T> Offset(PointOffset offset, T count)
 {
     return(offset switch
     {
         PointOffset.None => this,
         PointOffset.Up => this - new Point <T>(0, count),
         PointOffset.Down => this + new Point <T>(0, count),
         PointOffset.Left => this - new Point <T>(count, 0),
         PointOffset.Right => this + new Point <T>(count, 0),
         PointOffset.UpLeft => this - new Point <T>(count, count),
         PointOffset.DownLeft => this + new Point <T>(MathUnsafe.Negative(count), count),
         PointOffset.UpRight => this - new Point <T>(MathUnsafe.Negative(count), count),
         PointOffset.DownRight => this + new Point <T>(count, count),
         _ => throw new ArgumentOutOfRangeException(nameof(offset), offset, null)
     });