API reference
Struct RectF
Namespace: MicroEngine
Assembly: MicroEngine.Kernel.dll
Guide: Graphics
Axis-aligned rectangle in world or screen units (Y grows downward).
public readonly struct RectF : IEquatable<RectF>Implements
Constructors
RectF(float, float, float, float)
Axis-aligned rectangle in world or screen units (Y grows downward).
public RectF(float X, float Y, float Width, float Height)Parameters
X float
Left edge.
Y float
Top edge.
Width float
Width; rectangles with zero or negative size contain nothing.
Height float
Height.
Properties
Bottom
The bottom edge, Y + Height (exclusive).
public float Bottom { get; }Property Value
Center
The centre point.
public Vector2 Center { get; }Property Value
Height
Height.
public float Height { get; init; }Property Value
Left
The left edge (X).
public float Left { get; }Property Value
Position
The top-left corner.
public Vector2 Position { get; }Property Value
Right
The right edge, X + Width (exclusive).
public float Right { get; }Property Value
Size
Width and height as a vector.
public Vector2 Size { get; }Property Value
Top
The top edge (Y).
public float Top { get; }Property Value
Width
Width; rectangles with zero or negative size contain nothing.
public float Width { get; init; }Property Value
X
Left edge.
public float X { get; init; }Property Value
Y
Top edge.
public float Y { get; init; }Property Value
Methods
Contains(Vector2)
Whether point is inside; the left and top edges are inside, the right and bottom edges are not.
public bool Contains(Vector2 point)Parameters
point Vector2
Returns
Deconstruct(out float, out float, out float, out float)
public void Deconstruct(out float X, out float Y, out float Width, out float Height)Parameters
X float
Y float
Width float
Height float
Equals(object)
public override bool Equals(object obj)Parameters
obj object
Returns
Equals(RectF)
public bool Equals(RectF other)Parameters
other RectF
Returns
FromCenter(Vector2, float, float)
A rectangle of the given size centred on center.
public static RectF FromCenter(Vector2 center, float width, float height)Parameters
center Vector2
width float
height float
Returns
GetHashCode()
public override int GetHashCode()Returns
Inflate(float)
A copy grown by amount on every side (shrunk when negative).
public RectF Inflate(float amount)Parameters
amount float
Returns
Intersection(RectF)
The overlapping area of both rectangles, or default (all zeros) when they do not overlap.
public RectF Intersection(RectF other)Parameters
other RectF
Returns
Intersects(RectF)
Strict overlap: rectangles that only share an edge do not intersect.
public bool Intersects(RectF other)Parameters
other RectF
Returns
Offset(float, float)
A copy moved by (dx, dy).
public RectF Offset(float dx, float dy)Parameters
dx float
dy float
Returns
Offset(Vector2)
A copy moved by delta.
public RectF Offset(Vector2 delta)Parameters
delta Vector2
Returns
ToString()
public override string ToString()Returns
Operators
operator ==(RectF, RectF)
public static bool operator ==(RectF left, RectF right)Parameters
left RectF
right RectF
Returns
operator !=(RectF, RectF)
public static bool operator !=(RectF left, RectF right)Parameters
left RectF
right RectF