Table of Contents

Struct Rect

Namespace
LibGFX.Math
Assembly
LibGFX.dll

Represents a rectangle defined by its position and size.

public struct Rect
Inherited Members

Constructors

Rect()

Initializes a new instance of the Rect struct with default values.

public Rect()

Rect(float, float, float, float)

Initializes a new instance of the Rect struct with specified position and size.

public Rect(float x, float y, float width, float height)

Parameters

x float
y float
width float
height float

Properties

Height

The height of the rectangle.

public float Height { readonly get; set; }

Property Value

float

Width

The width of the rectangle.

public float Width { readonly get; set; }

Property Value

float

X

The X coordinate of the rectangle's position.

public float X { readonly get; set; }

Property Value

float

Y

The Y coordinate of the rectangle's position.

public float Y { readonly get; set; }

Property Value

float

Methods

Contains(Vector2)

Checks if the rectangle contains a point defined by a Vector2.

public bool Contains(Vector2 vector2)

Parameters

vector2 Vector2

Returns

bool

Contains(float, float)

Checks if the rectangle contains a point defined by its X and Y coordinates.

public bool Contains(float x, float y)

Parameters

x float
y float

Returns

bool

Intersects(Rect)

Checks if the rectangle intersects with another rectangle.

public bool Intersects(Rect other)

Parameters

other Rect

Returns

bool