Rectangle

2D Rectangle class.

Constructor

new Rectangle(leftopt, topopt, rightopt, bottomopt)

Parameters:
NameTypeAttributesDescription
leftnumber<optional>

Left coordinate. 0 - default.

topnumber<optional>

Top coordinate. 0 - default.

rightnumber<optional>

Right coordinate. 0 - default.

bottomnumber<optional>

Bottom coordinate. 0 - default.

Methods

clone() → {Rectangle}

Clone rectangle object.

Returns:
Type: 
Rectangle

fit(width, height)

Returns true if rectangle fits their size in width and height.

Parameters:
NameTypeDescription
widthnumber

Width.

heightnumber

Height.

getDiagonal()

Returns rectangle diagonal size.

getHeight()

Returns rectangle height.

getSquare()

Returns rectangle area.

getWidth()

Returns rectangle width.