Skip to content

API reference

Struct RectF

Namespace: MicroEngine
Assembly: MicroEngine.Kernel.dll
Guide: Graphics

Axis-aligned rectangle in world or screen units (Y grows downward).

C#
public readonly struct RectF : IEquatable<RectF>

Implements

IEquatable<RectF>

Constructors

RectF(float, float, float, float)

Axis-aligned rectangle in world or screen units (Y grows downward).

C#
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).

C#
public float Bottom { get; }

Property Value

float

Center

The centre point.

C#
public Vector2 Center { get; }

Property Value

Vector2

Height

Height.

C#
public float Height { get; init; }

Property Value

float

Left

The left edge (X).

C#
public float Left { get; }

Property Value

float

Position

The top-left corner.

C#
public Vector2 Position { get; }

Property Value

Vector2

Right

The right edge, X + Width (exclusive).

C#
public float Right { get; }

Property Value

float

Size

Width and height as a vector.

C#
public Vector2 Size { get; }

Property Value

Vector2

Top

The top edge (Y).

C#
public float Top { get; }

Property Value

float

Width

Width; rectangles with zero or negative size contain nothing.

C#
public float Width { get; init; }

Property Value

float

X

Left edge.

C#
public float X { get; init; }

Property Value

float

Y

Top edge.

C#
public float Y { get; init; }

Property Value

float

Methods

Contains(Vector2)

Whether point is inside; the left and top edges are inside, the right and bottom edges are not.

C#
public bool Contains(Vector2 point)

Parameters

point Vector2

Returns

bool

Deconstruct(out float, out float, out float, out float)

C#
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)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(RectF)

C#
public bool Equals(RectF other)

Parameters

other RectF

Returns

bool

FromCenter(Vector2, float, float)

A rectangle of the given size centred on center.

C#
public static RectF FromCenter(Vector2 center, float width, float height)

Parameters

center Vector2

width float

height float

Returns

RectF

GetHashCode()

C#
public override int GetHashCode()

Returns

int

Inflate(float)

A copy grown by amount on every side (shrunk when negative).

C#
public RectF Inflate(float amount)

Parameters

amount float

Returns

RectF

Intersection(RectF)

The overlapping area of both rectangles, or default (all zeros) when they do not overlap.

C#
public RectF Intersection(RectF other)

Parameters

other RectF

Returns

RectF

Intersects(RectF)

Strict overlap: rectangles that only share an edge do not intersect.

C#
public bool Intersects(RectF other)

Parameters

other RectF

Returns

bool

Offset(float, float)

A copy moved by (dx, dy).

C#
public RectF Offset(float dx, float dy)

Parameters

dx float

dy float

Returns

RectF

Offset(Vector2)

A copy moved by delta.

C#
public RectF Offset(Vector2 delta)

Parameters

delta Vector2

Returns

RectF

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(RectF, RectF)

C#
public static bool operator ==(RectF left, RectF right)

Parameters

left RectF

right RectF

Returns

bool

operator !=(RectF, RectF)

C#
public static bool operator !=(RectF left, RectF right)

Parameters

left RectF

right RectF

Returns

bool