GridHelper
Namespace: Murder.Utilities
Assembly: Murder.dll
public static class GridHelper
⭐ Methods
Circle(int, int, int)
public IEnumerable<T> Circle(int cx, int cy, int radius)
Parameters
cx
int
cy
int
radius
int
Returns
IEnumerable<T>
Line(Point, Point)
public IEnumerable<T> Line(Point start, Point end)
Parameters
start
Point
end
Point
Returns
IEnumerable<T>
Reverse(IDictionary<TKey, TValue>, Point, Point)
public ImmutableDictionary<TKey, TValue> Reverse(IDictionary<TKey, TValue> input, Point initial, Point target)
Parameters
input
IDictionary<TKey, TValue>
initial
Point
target
Point
Returns
ImmutableDictionary<TKey, TValue>
SnapToGridDelta(IMurderTransformComponent)
public IMurderTransformComponent SnapToGridDelta(IMurderTransformComponent transform)
Parameters
transform
IMurderTransformComponent
Returns
IMurderTransformComponent
FromTopLeftToBottomRight(Point, Point)
public IntRectangle FromTopLeftToBottomRight(Point p1, Point p2)
Creates a rectangle from
Returns
IntRectangle
GetBoundingBox(Rectangle)
public IntRectangle GetBoundingBox(Rectangle rect)
Parameters
rect
Rectangle
Returns
IntRectangle
GetCarveBoundingBox(Rectangle, float)
public IntRectangle GetCarveBoundingBox(Rectangle rect, float occupiedThreshold)
Parameters
rect
Rectangle
occupiedThreshold
float
Returns
IntRectangle
ToGrid(Point)
public Point ToGrid(Point position)
Parameters
position
Point
Returns
Point
ToGrid(Vector2)
public Point ToGrid(Vector2 position)
Parameters
position
Vector2
Returns
Point
Neighbours(Point, int, int, bool)
public ReadOnlySpan<T> Neighbours(Point p, int width, int height, bool includeDiagonals)
Returns all the neighbours of a position.
Parameters
p
Point
width
int
height
int
includeDiagonals
bool
Returns
ReadOnlySpan<T>
Neighbours(Point, int, int, int, int, bool)
public ReadOnlySpan<T> Neighbours(Point p, int x, int y, int edgeX, int edgeY, bool includeDiagonals)
Returns all the neighbours of a position.
Parameters
p
Point
x
int
y
int
edgeX
int
edgeY
int
includeDiagonals
bool
Returns
ReadOnlySpan<T>
FromTopLeftToBottomRight(Vector2, Vector2)
public Rectangle FromTopLeftToBottomRight(Vector2 p1, Vector2 p2)
Creates a rectangle from
Parameters
p1
Vector2
p2
Vector2
Returns
Rectangle
ToRectangle(Point)
public Rectangle ToRectangle(Point grid)
Parameters
grid
Point
Returns
Rectangle
SnapToGridDelta(Vector2)
public Vector2 SnapToGridDelta(Vector2 vector2)
Parameters
vector2
Vector2
Returns
Vector2
⚡