Rectangle
Namespace: Murder.Core.Geometry
Assembly: Murder.dll
public sealed struct Rectangle : IEquatable<T>
Implements: IEquatable<T>
⭐ Constructors
public Rectangle(Point p, int width, int height)
Parameters
p Point
width int
height int
public Rectangle(Point position, Point size)
Parameters
position Point
size Point
public Rectangle(float x, float y, float width, float height)
Parameters
x float
y float
width float
height float
public Rectangle(int x, int y, int width, int height)
Parameters
x int
y int
width int
height int
public Rectangle(Vector2 position, Vector2 size)
Parameters
position Vector2
size Vector2
⭐ Properties
Bottom
public float Bottom { get; public set; }
Returns
float
BottomCenter
public Vector2 BottomCenter { get; }
Returns
Vector2
BottomLeft
public Vector2 BottomLeft { get; }
Returns
Vector2
BottomRight
public Vector2 BottomRight { get; }
Returns
Vector2
Center
public Vector2 Center { get; }
Returns
Vector2
CenterLeft
public Vector2 CenterLeft { get; }
Returns
Vector2
CenterPoint
public Point CenterPoint { get; }
Returns
Point
Empty
public static Rectangle Empty { get; }
Returns
Rectangle
Height
public float Height;
Returns
float
HeightRound
public int HeightRound { get; }
Returns
int
IsEmpty
public bool IsEmpty { get; }
Returns
bool
Left
public float Left { get; public set; }
Returns
float
One
public static Rectangle One { get; }
Returns
Rectangle
Right
public float Right { get; public set; }
Returns
float
Size
public Vector2 Size { get; public set; }
Returns
Vector2
Top
public float Top { get; public set; }
Returns
float
TopCenter
public Vector2 TopCenter { get; }
Returns
Vector2
TopLeft
public Vector2 TopLeft { get; }
Returns
Vector2
TopRight
public Vector2 TopRight { get; }
Returns
Vector2
Width
public float Width;
Returns
float
WidthRound
public int WidthRound { get; }
Returns
int
X
public float X;
Returns
float
XRound
public int XRound { get; }
Returns
int
Y
public float Y;
Returns
float
YRound
public int YRound { get; }
Returns
int
⭐ Methods
Contains(Point)
public bool Contains(Point point)
Parameters
point Point
Returns
bool
Contains(float, float)
public bool Contains(float X, float Y)
Returns
bool
Contains(int, int)
public bool Contains(int X, int Y)
Returns
bool
Contains(Vector2)
public bool Contains(Vector2 vector)
Parameters
vector Vector2
Returns
bool
Touches(Rectangle)
public bool Touches(Rectangle other)
Gets whether or not the other Rectangle intersects with this rectangle.
Parameters
other Rectangle
Returns
bool
TouchesInside(Rectangle)
public bool TouchesInside(Rectangle other)
Gets whether or not the other Rectangle intersects with this rectangle.
Parameters
other Rectangle
Returns
bool
TouchesWithMaxRotationCheck(Vector2, Vector2, Vector2)
public bool TouchesWithMaxRotationCheck(Vector2 position, Vector2 size, Vector2 offset)
Whether an object within bounds intersects with this rectangle. This takes into account the "maximum" height and length given any rotation.
Parameters
position Vector2
size Vector2
offset Vector2
Returns
bool
SubtractRectangles(Rectangle, Rectangle)
public IEnumerable<T> SubtractRectangles(Rectangle main, Rectangle subtract)
Parameters
main Rectangle
subtract Rectangle
Returns
IEnumerable<T>
AddPadding(float, float, float, float)
public Rectangle AddPadding(float left, float top, float right, float bottom)
Parameters
left float
top float
right float
bottom float
Returns
Rectangle
AddPosition(Point)
public Rectangle AddPosition(Point position)
Parameters
position Point
Returns
Rectangle
AddPosition(Vector2)
public Rectangle AddPosition(Vector2 position)
Parameters
position Vector2
Returns
Rectangle
CenterRectangle(Point, int, int)
public Rectangle CenterRectangle(Point center, int width, int height)
Parameters
center Point
width int
height int
Returns
Rectangle
CenterRectangle(float, float)
public Rectangle CenterRectangle(float x, float y)
Returns
Rectangle
CenterRectangle(Vector2, float, float)
public Rectangle CenterRectangle(Vector2 center, float width, float height)
Parameters
center Vector2
width float
height float
Returns
Rectangle
CenterRectangle(Vector2)
public Rectangle CenterRectangle(Vector2 size)
Parameters
size Vector2
Returns
Rectangle
Expand(float)
public Rectangle Expand(float value)
Parameters
value float
Returns
Rectangle
Expand(int)
public Rectangle Expand(int value)
Parameters
value int
Returns
Rectangle
FromCoordinates(float, float, float, float)
public Rectangle FromCoordinates(float top, float bottom, float left, float right)
Constructor for a rectangle from a set of coordinates.
Parameters
top float
bottom float
left float
right float
Returns
Rectangle
FromCoordinates(Vector2, Vector2)
public Rectangle FromCoordinates(Vector2 topLeft, Vector2 bottomRight)
Constructor for a rectangle from a set of coordinates.
Parameters
topLeft Vector2
bottomRight Vector2
Returns
Rectangle
Intersection(Rectangle, Rectangle)
public Rectangle Intersection(Rectangle a, Rectangle b)
Parameters
a Rectangle
b Rectangle
Returns
Rectangle
Lerp(Rectangle, Rectangle, float)
public Rectangle Lerp(Rectangle a, Rectangle b, float v)
Parameters
a Rectangle
b Rectangle
v float
Returns
Rectangle
SetPosition(Vector2)
public Rectangle SetPosition(Vector2 position)
Parameters
position Vector2
Returns
Rectangle
Equals(Rectangle)
public virtual bool Equals(Rectangle other)
Parameters
other Rectangle
Returns
bool
Equals(Object)
public virtual bool Equals(Object obj)
Parameters
obj Object
Returns
bool
GetHashCode()
public virtual int GetHashCode()
Returns
int
⚡