Cuboid

geometry. Cuboid

# new Cuboid()

Formulas related to cuboids.

Methods

# area(w, h, l)

Calculates the area of a cuboid from its width, length and height.
Parameters:
Name Type Description
w number width
h number height
l number length
Returns:
2(wl+hl+lw)
Example
mathform.geometry.Cuboid.area(1, 2, 3); // 22

# diagonal(w, h, l)

Calculates the diagonal of a cuboid from its width, length and height.
Parameters:
Name Type Description
w number width
h number height
l number length
Returns:
√(w²+h²+l²)
Example
mathform.geometry.Cuboid.diagonal(1, 2, 3); // ~3.74

# sideFromDiagonal(d, a, b)

Calculates a side of a cuboid from its other 2 sides and its diagonal.
Parameters:
Name Type Description
d number diagonal
a number side a
b number side b
Returns:
√(d²-a²-b²)
Example
mathform.geometry.Cuboid.sideFromDiagonal(2, 1, 1); // sqrt(2)

# sideFromVolume(V, a, b)

Calculates a side of a cuboid from its other 2 sides and its Volume.
Parameters:
Name Type Description
V number Volume
a number side a
b number side b
Returns:
Vab
Example
mathform.geometry.Cuboid.sideFromVolume(1, 1, 1); // 1

# volume(w, h, l)

Calculates the volume of a cuboid from its width, length and height.
Parameters:
Name Type Description
w number width
h number height
l number length
Returns:
whl
Example
mathform.geometry.Cuboid.volume(1, 2, 3); // 6