You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
2 months ago
|
public static class SideAndCornerExtensions
|
||
|
{
|
||
|
public static (Corner, Corner) GetCorners(this Side side)
|
||
|
=> side switch {
|
||
|
Side.Left => (Corner.TopLeft, Corner.BottomLeft),
|
||
|
Side.Top => (Corner.TopLeft, Corner.TopRight),
|
||
|
Side.Right => (Corner.TopRight, Corner.BottomRight),
|
||
|
Side.Bottom => (Corner.BottomLeft, Corner.BottomRight),
|
||
|
_ => throw new ArgumentException($"Invalid Side value '{side}'", nameof(side)),
|
||
|
};
|
||
|
|
||
|
public static Side GetOpposite(this Side side)
|
||
|
=> side switch {
|
||
|
Side.Left => Side.Right,
|
||
|
Side.Top => Side.Bottom,
|
||
|
Side.Right => Side.Left,
|
||
|
Side.Bottom => Side.Top,
|
||
|
_ => throw new ArgumentException($"Invalid Side value '{side}'", nameof(side)),
|
||
|
};
|
||
|
|
||
|
public static Corner GetOpposite(this Corner corner)
|
||
|
=> corner switch {
|
||
|
Corner.TopLeft => Corner.BottomRight,
|
||
|
Corner.TopRight => Corner.BottomLeft,
|
||
|
Corner.BottomRight => Corner.TopLeft,
|
||
|
Corner.BottomLeft => Corner.TopRight,
|
||
|
_ => throw new ArgumentException($"Invalid Corner value '{corner}'", nameof(corner)),
|
||
|
};
|
||
|
}
|