Table of Contents

Struct Rect2f

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

A rectangle with float type coordinates in 2D space

[Serializable]
[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")]
public record struct Rect2f : IEquatable<Rect2f>
Implements
Inherited Members

Constructors

Rect2f(Point2f, Size2f)

Constructor

Rect2f(float, float, float, float)

A rectangle with float type coordinates in 2D space

Fields

Height

The height of the rectangle.

Width

The width of the rectangle.

X

The x-coordinate of the upper-left corner of the rectangle.

Y

The y-coordinate of the upper-left corner of the rectangle.

Properties

Bottom

Gets the y-coordinate that is the sum of the Y and Height property values of this Rect2f structure.

BottomRight

Coordinate of the right-most rectangle corner [Point2f(X+Width, Y+Height)]

Left

Gets the x-coordinate of the left edge of this Rect2f structure.

Location

Coordinate of the left-most rectangle corner [Point2f(X, Y)]

Right

Gets the x-coordinate that is the sum of X and Width property values of this Rect2f structure.

Size

Size of the rectangle [CvSize(Width, Height)]

Top

Gets the y-coordinate of the top edge of this Rect2f structure.

TopLeft

Coordinate of the left-most rectangle corner [Point2f(X, Y)]

Methods

Add(Point2f)

Shifts rectangle by a certain offset

Add(Size2f)

Expands or shrinks rectangle by a certain amount

Contains(Point2f)

Determines if the specified point is contained within the rectangular region defined by this Rectangle.

Contains(Rect2f)

Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle.

Contains(float, float)

Determines if the specified point is contained within the rectangular region defined by this Rectangle.

FromLTRB(float, float, float, float)
Inflate(Rect, int, int)

Creates and returns an inflated copy of the specified Rect2f structure.

Inflate(Size2f)

Inflates this Rect by the specified amount.

Inflate(float, float)

Inflates this Rect by the specified amount.

Intersect(Rect2f)

Determines the Rect2f structure that represents the intersection of two rectangles.

Intersect(Rect2f, Rect2f)

Determines the Rect2f structure that represents the intersection of two rectangles.

IntersectsWith(Rect2f)

Determines if this rectangle intersects with rect.

Subtract(Point2f)

Shifts rectangle by a certain offset

Subtract(Size2f)

Expands or shrinks rectangle by a certain amount

Union(Rect2f)

Gets a Rect2f structure that contains the union of two Rect2f structures.

Union(Rect2f, Rect2f)

Gets a Rect2f structure that contains the union of two Rect2f structures.

Operators

operator +(Rect2f, Point2f)

Shifts rectangle by a certain offset

operator +(Rect2f, Size2f)

Expands or shrinks rectangle by a certain amount

operator &(Rect2f, Rect2f)

Determines the Rect2f structure that represents the intersection of two rectangles.

operator |(Rect2f, Rect2f)

Gets a Rect2f structure that contains the union of two Rect2f structures.

operator -(Rect2f, Point2f)

Shifts rectangle by a certain offset

operator -(Rect2f, Size2f)

Expands or shrinks rectangle by a certain amount