Class: Rect

H.math.Rect

new H.math.Rect (left, top, right, bottom)

This class defines a rectangle in two-dimensional geometric space. It is used to represent the area in projected space.

Name Type Description
left number

An x-value indicating the left edge of the rectangle

top number

A y-value indicating the top edge of the rectangle

right number

An x-value indicating the right edge of the rectangle

bottom number

A y-value indicating the bottom edge of the rectangle

Members

bottom number

This property holds a y-value indicating the bottom edge of the rectangle.

left number

This property holds an x-value indicating the left edge of the rectangle.

This property holds an x-value indicating the right edge of the rectangle.

top number

This property holds a y-value indicating the top edge of the rectangle.

Methods

H.math.Rect.fromPoints (topLeft, bottomRight)H.math.Rect static

This method creates a rectangle from a top-left and bottom-right point pair.

Name Type Description
topLeft H.math.IPoint

The top-left vertex of the rectangle

bottomRight H.math.IPoint

The bottom-right vertex of the rectangle

Returns:
Type Description
H.math.Rect The rectangular area defined by its top-left and bottom-right vertices

clone ()H.math.Rect

This method clones the given rectangle.

Returns:
Type Description
H.math.Rect An object representing the newly clone rectangle

containsXY (x, y)boolean

This method checks if the provided coordinates lie within the rectangle.

Name Type Description
x number

The value of the x-coordinate to check

y number

The value of the y-coordinate to check

Returns:
Type Description
boolean true if the coordinates lie within the rectangle, false if the parameters are isNaN

getBottomRight ()H.math.Point

This method retrieves the bottom-right vertex of the rectangle.

Returns:
Type Description
H.math.Point An object containing the screen coordinates of the bottom-right vertex of the rectangle

getTopLeft ()H.math.Point

This method retrieves the top-left vertex of the rectangle.

Returns:
Type Description
H.math.Point An object containing the screen coordinates of the top-left vertex of the rectangle

set (left, top, right, bottom)

This method sets the values of the edges of the rectangle.

Name Type Description
left number

An x-value indicating the left edge of the rectangle

top number

A y-value indicating the top edge of the rectangle

right number

An x-value indicating the right edge of the rectangle

bottom number

A y-value indicating the bottom edge of the rectangle