1.0.7 • Published 2 years ago
math-area v1.0.7
Math Area
Support calculating the area of objects
Example
const mathArea = require('math-area')
mathArea.squareArea(5) // should return 25
mathArea.hypotenuseOfPythagoreanTriangle(3, 4) // should return 5
mathArea.rhombusArea(4, 5) // provides diagonal 1 and diagonal 2 as parameters
// provides (short, long, height) as paramters to calculate trapezium with short < long
// however, if you mix the short and long, for example: (5, 4, 2), it is auto switch the values.
mathArea.trapezoidArea(4, 5, 2)
mathArea.circleArea(4.5) // provides radius as a parameter
Conventions
Calculate area of an object:
[name of object in lowercase] + Area For example: squareArea(5)
Calculate perimeter of an object:
[name of object in lowercase] + Perimeter For example: squarePerimeter(4)
Calculate others:
[name] + Of + [name of object] For example: hypotenuseOfPythagoreanTriangle(3, 4)
Support Geometry Calculations
Syntax | Description |
---|---|
@v1.0.4 | Circle (diameter, area) Square(area, perimeter) Triangle (area, perimeter) Pythagorean Triangle (side, hypotenuse) Rectangle (area, perimeter) Trapezoid (area, perimeter) Rhombus(area, perimeter) |
Note: New objects will come every week! :joy: