Struct Rect2d
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
Stores a set of four double-precision floating-point numbers that represent the location and size of a rectangle
[Serializable]
public record struct Rect2d : IEquatable<Rect2d>
- Implements
- Inherited Members
Constructors
Rect2d(Point2d, Size2d)
Constructor
public Rect2d(Point2d location, Size2d size)
Parameters
Rect2d(double, double, double, double)
Stores a set of four double-precision floating-point numbers that represent the location and size of a rectangle
public Rect2d(double X, double Y, double Width, double Height)
Parameters
XdoubleThe x-coordinate of the upper-left corner of the rectangle.
YdoubleThe y-coordinate of the upper-left corner of the rectangle.
WidthdoubleThe width of the rectangle.
HeightdoubleThe height of the rectangle.
Fields
Height
The height of the rectangle.
public double Height
Field Value
Width
The width of the rectangle.
public double Width
Field Value
X
The x-coordinate of the upper-left corner of the rectangle.
public double X
Field Value
Y
The y-coordinate of the upper-left corner of the rectangle.
public double Y
Field Value
Properties
Bottom
Gets the y-coordinate that is the sum of the Y and Height property values of this Rect2d structure.
public readonly double Bottom { get; }
Property Value
BottomRight
Coordinate of the right-most rectangle corner [Point2d(X+Width, Y+Height)]
public readonly Point2d BottomRight { get; }
Property Value
Left
Gets the x-coordinate of the left edge of this Rect2d structure.
public double Left { readonly get; set; }
Property Value
Location
Coordinate of the left-most rectangle corner [Point2d(X, Y)]
public Point2d Location { readonly get; set; }
Property Value
Right
Gets the x-coordinate that is the sum of X and Width property values of this Rect2d structure.
public readonly double Right { get; }
Property Value
Size
Size of the rectangle [CvSize(Width, Height)]
public Size2d Size { readonly get; set; }
Property Value
Top
Gets the y-coordinate of the top edge of this Rect2d structure.
public double Top { readonly get; set; }
Property Value
TopLeft
Coordinate of the left-most rectangle corner [Point2d(X, Y)]
public readonly Point2d TopLeft { get; }
Property Value
Methods
Add(Point2d)
Shifts rectangle by a certain offset
public readonly Rect2d Add(Point2d pt)
Parameters
ptPoint2d
Returns
Add(Size2d)
Shifts rectangle by a certain offset
public readonly Rect2d Add(Size2d size)
Parameters
sizeSize2d
Returns
Contains(Point2d)
Determines if the specified point is contained within the rectangular region defined by this Rectangle.
public readonly bool Contains(Point2d pt)
Parameters
ptPoint2dpoint
Returns
Contains(Rect2d)
Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle.
public readonly bool Contains(Rect2d rect)
Parameters
rectRect2drectangle
Returns
Contains(double, double)
Determines if the specified point is contained within the rectangular region defined by this Rectangle.
public readonly bool Contains(double x, double y)
Parameters
Returns
FromLTRB(double, double, double, double)
public static Rect2d FromLTRB(double left, double top, double right, double bottom)
Parameters
Returns
Inflate(Rect, int, int)
Creates and returns an inflated copy of the specified Rect2d structure.
public static Rect Inflate(Rect rect, int x, int y)
Parameters
rectRectThe Rectangle with which to start. This rectangle is not modified.
xintThe amount to inflate this Rectangle horizontally.
yintThe amount to inflate this Rectangle vertically.
Returns
Inflate(Size2d)
Inflates this Rect by the specified amount.
public void Inflate(Size2d size)
Parameters
sizeSize2dThe amount to inflate this rectangle.
Inflate(double, double)
Inflates this Rect by the specified amount.
public void Inflate(double width, double height)
Parameters
widthdoubleThe amount to inflate this Rectangle horizontally.
heightdoubleThe amount to inflate this Rectangle vertically.
Intersect(Rect2d)
Determines the Rect2d structure that represents the intersection of two rectangles.
public readonly Rect2d Intersect(Rect2d rect)
Parameters
rectRect2dA rectangle to intersect.
Returns
Intersect(Rect2d, Rect2d)
Determines the Rect2d structure that represents the intersection of two rectangles.
public static Rect2d Intersect(Rect2d a, Rect2d b)
Parameters
Returns
IntersectsWith(Rect2d)
Determines if this rectangle intersects with rect.
public readonly bool IntersectsWith(Rect2d rect)
Parameters
rectRect2dRectangle
Returns
Subtract(Point2d)
Shifts rectangle by a certain offset
public readonly Rect2d Subtract(Point2d pt)
Parameters
ptPoint2d
Returns
Subtract(Size2d)
Shifts rectangle by a certain offset
public readonly Rect2d Subtract(Size2d size)
Parameters
sizeSize2d
Returns
ToRect()
public readonly Rect ToRect()
Returns
Union(Rect2d)
Gets a Rect2d structure that contains the union of two Rect2d structures.
public readonly Rect2d Union(Rect2d rect)
Parameters
rectRect2dA rectangle to union.
Returns
Union(Rect2d, Rect2d)
Gets a Rect2d structure that contains the union of two Rect2d structures.
public static Rect2d Union(Rect2d a, Rect2d b)
Parameters
Returns
Operators
operator +(Rect2d, Point2d)
Shifts rectangle by a certain offset
public static Rect2d operator +(Rect2d rect, Point2d pt)
Parameters
Returns
operator +(Rect2d, Size2d)
Expands or shrinks rectangle by a certain amount
public static Rect2d operator +(Rect2d rect, Size2d size)
Parameters
Returns
operator &(Rect2d, Rect2d)
Determines the Rect2d structure that represents the intersection of two rectangles.
[SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")]
public static Rect2d operator &(Rect2d a, Rect2d b)
Parameters
Returns
operator |(Rect2d, Rect2d)
Gets a Rect2d structure that contains the union of two Rect2d structures.
[SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")]
public static Rect2d operator |(Rect2d a, Rect2d b)
Parameters
Returns
operator -(Rect2d, Point2d)
Shifts rectangle by a certain offset
public static Rect2d operator -(Rect2d rect, Point2d pt)
Parameters
Returns
operator -(Rect2d, Size2d)
Expands or shrinks rectangle by a certain amount
public static Rect2d operator -(Rect2d rect, Size2d size)