Table of Contents

Struct Rect

Namespace
FlowGraph.Core.Elements
Assembly
FlowGraph.Core.dll

Represents a rectangle with position and size. Used for element bounds calculations.

public readonly record struct Rect : IEquatable<Rect>
Implements
Inherited Members

Constructors

Rect(double, double, double, double)

Represents a rectangle with position and size. Used for element bounds calculations.

public Rect(double X, double Y, double Width, double Height)

Parameters

X double

The X coordinate of the top-left corner.

Y double

The Y coordinate of the top-left corner.

Width double

The width of the rectangle.

Height double

The height of the rectangle.

Properties

Bottom

Gets the bottom edge Y coordinate.

public double Bottom { get; }

Property Value

double

Center

Gets the center point of the rectangle.

public Point Center { get; }

Property Value

Point

Empty

Creates an empty rectangle at the origin.

public static Rect Empty { get; }

Property Value

Rect

Height

The height of the rectangle.

public double Height { get; init; }

Property Value

double

Left

Gets the left edge X coordinate.

public double Left { get; }

Property Value

double

Right

Gets the right edge X coordinate.

public double Right { get; }

Property Value

double

Top

Gets the top edge Y coordinate.

public double Top { get; }

Property Value

double

Width

The width of the rectangle.

public double Width { get; init; }

Property Value

double

X

The X coordinate of the top-left corner.

public double X { get; init; }

Property Value

double

Y

The Y coordinate of the top-left corner.

public double Y { get; init; }

Property Value

double

Methods

Contains(Rect)

Determines whether this rectangle fully contains another rectangle.

public bool Contains(Rect other)

Parameters

other Rect

Returns

bool

Contains(Point)

Determines whether this rectangle contains the specified point.

public bool Contains(Point point)

Parameters

point Point

Returns

bool

Inflate(double)

Returns a new rectangle expanded by the specified amount on all sides.

public Rect Inflate(double amount)

Parameters

amount double

Returns

Rect

Intersects(Rect)

Determines whether this rectangle intersects with another rectangle.

public bool Intersects(Rect other)

Parameters

other Rect

Returns

bool

Union(Rect)

Returns the union of this rectangle with another.

public Rect Union(Rect other)

Parameters

other Rect

Returns

Rect