# Maps API for JavaScript

Maps API for JavaScript Developer's Guide

# H.math.Rect

## Class Summary

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

[ For full details, see the Class Details ]

## Method Summary

Table 1. Methods
Methods

` set (left, top, right, bottom)`

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

` getTopLeft () : {H.math.Point}`

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

` getBottomRight () : {H.math.Point}`

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

` containsXY (x, y) : {boolean}`

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

`static fromPoints (topLeft, bottomRight) : {H.math.Rect}`

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

` clone () : {H.math.Rect}`

This method clones the given rectangle.

## Class Description

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

## Constructor Details

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

Parameters:

`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

## Method Details

` set (left, top, right, bottom)`

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

Parameters:

`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

` getTopLeft () : {H.math.Point}`

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

Returns:

`{H.math.Point}`
An object containing the screen coordinates of the top-left vertex of the rectangle

` getBottomRight () : {H.math.Point}`

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

Returns:

`{H.math.Point}`
An object containing the screen coordinates of the bottom-right vertex of the rectangle

` containsXY (x, y) : {boolean}`

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

Parameters:

`x`:
`{number}`

The value of the x-coordinate to check
`y`:
`{number}`

The value of the y-coordinate to check
Returns:

`{boolean}`
`true` if the coordinates lie within the rectangle, `false` if the parameters are isNaN

`static fromPoints (topLeft, bottomRight) : {H.math.Rect}`

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

Parameters:

`topLeft`:
`{H.math.IPoint}`

The top-left vertex of the rectangle
`bottomRight`:
`{H.math.IPoint}`

The bottom-right vertex of the rectangle
Returns:

`{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:

`{H.math.Rect}`
An object representing the newly clone rectangle