Rectangle

geometry. Rectangle

# new Rectangle()

Formulas related to rectangles.

Methods

# area(w, h) → {number}

Calculates the area of a rectangle from width and height
Parameters:
Name Type Description
w number width
h number height
Returns:
wh
Type
number
Example
mathform.geometry.Rectangle.area(2, 2); // 4

# circumference(w, h) → {number}

Calculates the area of a rectangle from width and height
Parameters:
Name Type Description
w number width
h number height
Returns:
2w+2h
Type
number
Example
mathform.geometry.Rectangle.circumference(2, 2); // 8

# diagonal(w, h) → {number}

Calculates the area of a rectangle from width and height
Parameters:
Name Type Description
w number width
h number height
Returns:
√w²+h²
Type
number
Example
mathform.geometry.Rectangle.diagonal(1, 1); // sqrt(2)

# isSquare(w, h) → {boolean}

Evaluates if a rectangle is a square based on its width and height
Parameters:
Name Type Description
w number width
h number height
Returns:
w≡h
Type
boolean
Example
mathform.geometry.Rectangle.isSquare(2, 2); // true
mathform.geometry.Rectangle.isSquare(1, 2); // false