Table of Contents

Struct ViewportRect

Namespace
FlowGraph.Core.Coordinates
Assembly
FlowGraph.Core.dll

A rectangle in viewport coordinate space.

Viewport rectangles represent bounded regions in screen/control space. The most common use is representing the viewport bounds itself (the visible area).

public readonly record struct ViewportRect : IEquatable<ViewportRect>
Implements
Inherited Members
Extension Methods

Constructors

ViewportRect(double, double, double, double)

A rectangle in viewport coordinate space.

Viewport rectangles represent bounded regions in screen/control space. The most common use is representing the viewport bounds itself (the visible area).

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

Parameters

X double
Y double
Width double
Height double

Properties

Bottom

The bottom edge Y coordinate.

public double Bottom { get; }

Property Value

double

BottomLeft

The bottom-left corner of the rectangle.

public ViewportPoint BottomLeft { get; }

Property Value

ViewportPoint

BottomRight

The bottom-right corner of the rectangle.

public ViewportPoint BottomRight { get; }

Property Value

ViewportPoint

Center

The center of the rectangle.

public ViewportPoint Center { get; }

Property Value

ViewportPoint

Empty

An empty rectangle at the origin.

public static ViewportRect Empty { get; }

Property Value

ViewportRect

Height

public double Height { get; init; }

Property Value

double

IsEmpty

Whether this rectangle is empty (has zero or negative area).

public bool IsEmpty { get; }

Property Value

bool

Right

The right edge X coordinate.

public double Right { get; }

Property Value

double

TopLeft

The top-left corner of the rectangle.

public ViewportPoint TopLeft { get; }

Property Value

ViewportPoint

TopRight

The top-right corner of the rectangle.

public ViewportPoint TopRight { get; }

Property Value

ViewportPoint

Width

public double Width { get; init; }

Property Value

double

X

public double X { get; init; }

Property Value

double

Y

public double Y { get; init; }

Property Value

double

Methods

Contains(ViewportPoint)

Checks if this rectangle contains a point.

public bool Contains(ViewportPoint point)

Parameters

point ViewportPoint

Returns

bool

FromSize(double, double)

Creates a viewport rect representing the full viewport area at origin.

public static ViewportRect FromSize(double width, double height)

Parameters

width double

Viewport width.

height double

Viewport height.

Returns

ViewportRect

Inflate(double)

Returns a rectangle inflated by the specified amount on all sides.

public ViewportRect Inflate(double amount)

Parameters

amount double

Returns

ViewportRect

Intersects(ViewportRect)

Checks if this rectangle intersects with another rectangle.

public bool Intersects(ViewportRect other)

Parameters

other ViewportRect

Returns

bool

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.