Skip to main content

Description

Rectangle on an image.

Constructors

ConstructorDescription
Rect Rect( XCoordinate left, YCoordinate top, XCoordinate right, YCoordinate bottom )Constructs a value of type Rect from coordinates on the image. The boundaries of the rectangle are passed as parameters: left – left boundary, top – top boundary, right – right boundary, bottom – bottom boundary.

Operators

OperatorDescription
OrUnites two rectangles. The result is the smallest rectangle which contains both rectangles.
AndIntersects two rectangles. The result is the largest rectangle which is contained in both rectangles.

Methods

MethodDescription
XCoordinate Left()Returns the left boundary of the rectangle. Read-only property.
YCoordinate top()Returns the top boundary of the rectangle. Read-only property.
XCoordinate Right()Returns the right boundary of the rectangle. Read-only property.
YCoordinate Bottom()Returns the bottom boundary of the rectangle. Read-only property.
Distance Width()Returns the width of the rectangle. Read-only property.
Distance Height()Returns the height of the rectangle. Read-only property.
Area Area()Returns the area of the rectangle. Read-only property.
Void Left( XCoordinate x )Sets the left boundary of the rectangle.
Void top( YCoordinate y )Sets the top boundary of the rectangle.
Void Right( XCoordinate x )Sets the right boundary of the rectangle.
Void Bottom( YCoordinate y )Sets the bottom boundary of the rectangle.
XCoordinate XCenter()The X-coordinate of the center of the rectangle.
YCoordinate YCenter()The Y-coordinate of the center of the rectangle.
Void Inflate( Distance xDist, Distance yDist )Expands the rectangle by xDist to the left and to the right, and by yDist upwards and downwards.
XCoordinate GetX( Real ratio )Calculates the X-coordinate located within the rectangle between the Left and Right coordinates as Left + Width * ratio.
YCoordinate GetY( Real ratio )Calculates the Y-coordinate located within the rectangle between the top and Bottom coordinates as Top + Height * ratio.
Rect GetInflated( Distance xDist, Distance yDist )Returns an “expanded” rectangle. Each apex is shifted by xDist and yDist in the direction that expands the figure (the top left apex is moved upwards and to the left, etc.). -The rectangle itself remains unchanged.
Logic IsEmpty()Checks if the rectangle corresponds to a non-empty region on the image, i.e. a region whose Left < Right and top < Bottom.