# Class: Rect

A Rectangle is described by it top left coordinates (x, y), width, height and degrees of rotation around (x, y). Note that the coordinate system used is the one commonly used with images: x increases when going to the right y increases when going to the bottom degrees increases clockwise with 0 being the horizontal The constructor normalizes the rectangle to always have 0 <= degrees < 90
Members Methods

## Constructor

#### new Rect(xopt, yopt, widthopt, heightopt, degreesopt)

##### Parameters:
Name Type Attributes Default Description
`x` Number <optional>
0 The vector component 'x'.
`y` Number <optional>
0 The vector component 'y'.
`width` Number <optional>
0 The vector component 'width'.
`height` Number <optional>
0 The vector component 'height'.
`degrees` Number <optional>
0 Rotation of the rectangle around (x,y) in degrees.
Source:

### Members

#### degrees :Number

The rotation of the rectangle, in degrees.
• Number
Source:

#### height :Number

The vector component 'height'.
• Number
Source:

#### width :Number

The vector component 'width'.
• Number
Source:

#### x :Number

The vector component 'x'.
• Number
Source:

#### y :Number

The vector component 'y'.
• Number
Source:

### Methods

Source:
##### Returns:
a duplicate of this Rect
Type

#### containsPoint(point, epsilonopt) → {Boolean}

Determines whether a point is inside this rectangle (edge included).
##### Parameters:
Name Type Attributes Default Description
`point` OpenSeadragon.Point
`epsilon` Number <optional>
0 the margin of error allowed
Source:
##### Returns:
true if the point is inside this rectangle, false otherwise.
Type
Boolean

#### equals(rectangle) → {Boolean}

Determines if two Rectangles have equivalent components.
##### Parameters:
Name Type Description
`rectangle` OpenSeadragon.Rect The Rectangle to compare to.
Source:
##### Returns:
'true' if all components are equal, otherwise 'false'.
Type
Boolean

#### getAspectRatio() → {Number}

The aspect ratio is simply the ratio of width to height.
Source:
##### Returns:
The ratio of width to height.
Type
Number

Provides the coordinates of the bottom-left corner of the rectangle as a point.
Source:
##### Returns:
The coordinate of the bottom-left corner of the rectangle.
Type

Provides the coordinates of the bottom-right corner of the rectangle as a point.
Source:
##### Returns:
The coordinate of the bottom-right corner of the rectangle.
Type

Retrieves the smallest horizontal (degrees=0) rectangle which contains this rectangle.
Source:
##### Returns:
Type

Computes the center of the rectangle.
Source:
##### Returns:
The center of the rectangle as represented as represented by a 2-dimensional vector (x,y)
Type

Retrieves the smallest horizontal (degrees=0) rectangle which contains this rectangle and has integers x, y, width and height
Source:
##### Returns:
Type

Returns the width and height component as a vector OpenSeadragon.Point
Source:
##### Returns:
The 2 dimensional vector representing the width and height of the rectangle.
Type

Provides the coordinates of the upper-left corner of the rectangle as a point.
Source:
##### Returns:
The coordinate of the upper-left corner of the rectangle.
Type

Provides the coordinates of the top-right corner of the rectangle as a point.
Source:
##### Returns:
The coordinate of the top-right corner of the rectangle.
Type

Returns the bounding box of the intersection of this rectangle with the given rectangle.
##### Parameters:
Name Type Description
`rect` OpenSeadragon.Rect
Source:
##### Returns:
the bounding box of the intersection or null if the rectangles don't intersect.
Type

Rotates a rectangle around a point.
##### Parameters:
Name Type Attributes Description
`degrees` Number The angle in degrees to rotate.
`pivot` OpenSeadragon.Point <optional>
The point about which to rotate. Defaults to the center of the rectangle.
Source:
##### Returns:
Type

Multiply all dimensions (except degrees) in this Rect by a factor and return a new Rect.
##### Parameters:
Name Type Description
`factor` Number The factor to multiply vector components.
Source:
##### Returns:
A new rect representing the multiplication of the vector components by the factor
Type

#### toString() → {String}

Provides a string representation of the rectangle which is useful for debugging.
Source:
##### Returns:
A string representation of the rectangle.
Type
String

Translate/move this Rect by a vector and return new Rect.
##### Parameters:
Name Type Description
`delta` OpenSeadragon.Point The translation vector.
Source:
##### Returns:
A new rect with altered position
Type
`rect` OpenSeadragon.Rect