I

IRectangle

Interface for rectangles aligned to the axes in 2D coordinate space with double precision coordinates.
ImplementsInheritance Hierarchy

Remarks

This interface provides read access to the features of the rectangle only, however this does not mean that an instance that implements IRectangle will always return the same values for its properties. Often times the instance provides dynamic read access to the current state of a rectangle. It depends on the context whether it is allowed or even necessary to copy the state of the properties or whether the reference to the instance should always be used to query the values. This interface does not declare any additional methods. It combines the IPoint interface that describes the upper left corner of the rectangle with the ISize interface that describes the width and height of the rectangle.

This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.

It is possible to specify an Array or plain Object to define the Rect:

[5, 5, 20, 20] // x, y, width, height
{ x: 5, y: 5, width: 20, height: 20 }

See Also

Developer's Guide

API

IMutableRectangle, IMutablePoint, ISize, IPoint, MutableRectangle

Members

Show:

Properties

Gets the coordinates of the bottom left corner of the rectangle as a Point.
Gets the coordinates of the bottom right corner of the rectangle as a Point.
Gets the coordinates of the center of the rectangle as a Point.
Gets the center x-coordinate of the rectangle.
Gets the center y-coordinate of the rectangle.
Gets the current height of this instance.
Depending on context, the values returned may change over time.
readonlyabstract

Defined in

ISize.height
Determines whether the specified size is empty.
ISize instances are considered empty if their width or height is less than 0.0d.
readonly

Defined in

ISize.isEmpty
Gets the maximum x-coordinate of the rectangle.
This is the x-coordinate of the right side of the rectangle, or the left side if the rectangle is empty.
readonly
Gets the maximum y-coordinate of the rectangle.
This is the y-coordinate of the bottom side of the rectangle, or the top side if the rectangle is empty.
readonly
Gets the current size of the rectangle as Size.
Gets the coordinates of the top left corner of the rectangle as a Point.
Gets the coordinates of the top right corner of the rectangle as a Point.
Gets the current width of this instance.
Depending on context, the values returned may change over time.
readonlyabstract

Defined in

ISize.width
Gets the current x-coordinate of this point.
Depending on context, the values returned may change over time.
readonlyabstract
Gets the current y-coordinate of this point.
Depending on context, the values returned may change over time.
readonlyabstract

Methods

Determines whether the given rectangle contains the provided point.

Parameters

point: IPoint
The point to test.
eps?: number
A positive value allows for fuzzy hit testing. If the point lies outside the given object but its distance is less than or equal to that value, it will be considered a hit.

Return Value

boolean
true iff the point lies inside the rectangle.
Determines whether the given rectangle contains the provided rectangle.

More formally, this rectangle contains the other rectangle if the coordinates of each point of the other rectangle are neither less than this rectangle's x and y minus eps nor greater than this rectangle's MaxX and MaxY plus eps.

Consequently, an empty rectangle neither contains any other rectangle nor is it contained in any other rectangle.

Note, the result of this method can be counterintuitive if this rectangle's x or y is positive or negative infinity.

Parameters

other: IRectangle
The rectangle to test.
eps?: number
A positive value allows for fuzzy hit testing.

Return Value

boolean
true if the given rectangle contains the provided rectangle, false otherwise.
Creates a Rect instance with the current values of this rectangle.
This method can be used to obtain a copy of the current state of the rectangle and for using the utility methods that are available for the Rect type.

Return Value

Rect
A Rect that holds the values of the rectangle at the time of the invocation.

See Also

API
toMutableRectangle
Creates a new Size instance with the current values of this size.

Return Value

Size
A new Size instance that has been initialized with the current values of size.

Defined in

ISize.toSize

Static Methods

Creates a Rect instance from the given rectangle-like object by performing automatic type conversion.
static

Parameters

rectLike: Rect
The object to convert to a Rect.

Return Value

Rect
The given rectLike if it is already a Rect, or a new instance initialized to the values found in rectLike.