GeometryAreaService
katanakit-js / GeometryAreaService
Class: GeometryAreaService
Section titled “Class: GeometryAreaService”Defined in: core/services/geometry.service.ts:33
GeometryAreaService — pure area calculations for geometric shapes. All methods are stateless — input → formatted string only.
Applies the Singleton pattern (one shared instance via
GeometryAreaService.getInstance), exposed publicly through the
GeometryUtils.area facade. Every public method uses the use* prefix
per CONTRIBUTING.md.
Methods
Section titled “Methods”useCircle()
Section titled “useCircle()”useCircle(radius, options?): string;Defined in: core/services/geometry.service.ts:118
Calculates the area of a circle.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
radius |
number |
The radius of the circle. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useCircle(5); // "78.54"useEllipse()
Section titled “useEllipse()”useEllipse( semiMajor, semiMinor, options?): string;Defined in: core/services/geometry.service.ts:180
Calculates the area of an ellipse.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
semiMajor |
number |
The semi-major axis length. |
semiMinor |
number |
The semi-minor axis length. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useEllipse(5, 3); // "47.12"useHexagon()
Section titled “useHexagon()”useHexagon(side, options?): string;Defined in: core/services/geometry.service.ts:161
Calculates the area of a regular hexagon.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
side |
number |
The side length of the hexagon. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useHexagon(3); // "23.38"useParallelogram()
Section titled “useParallelogram()”useParallelogram( base, height, options?): string;Defined in: core/services/geometry.service.ts:199
Calculates the area of a parallelogram.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
base |
number |
The base length of the parallelogram. |
height |
number |
The height of the parallelogram. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useParallelogram(6, 4); // "24.00"useRectangle()
Section titled “useRectangle()”useRectangle( width, height, options?): string;Defined in: core/services/geometry.service.ts:63
Calculates the area of a rectangle.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
width |
number |
The width of the rectangle. |
height |
number |
The height of the rectangle. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useRectangle(5, 10); // "50.00"GeometryUtils.area.useRectangle(5, 10, { unit: "m²" }); // "50.00 m²"useSquare()
Section titled “useSquare()”useSquare(side, options?): string;Defined in: core/services/geometry.service.ts:81
Calculates the area of a square.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
side |
number |
The side length of the square. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useSquare(4); // "16.00"useTrapezoid()
Section titled “useTrapezoid()”useTrapezoid( parallelSide1, parallelSide2, height, options?): string;Defined in: core/services/geometry.service.ts:138
Calculates the area of a trapezoid.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
parallelSide1 |
number |
The length of the first parallel side. |
parallelSide2 |
number |
The length of the second parallel side. |
height |
number |
The height between parallel sides. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useTrapezoid(3, 5, 4); // "16.00"useTriangle()
Section titled “useTriangle()”useTriangle( base, height, options?): string;Defined in: core/services/geometry.service.ts:100
Calculates the area of a triangle.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
base |
number |
The base length of the triangle. |
height |
number |
The height of the triangle. |
options? |
{ digits?: number; locale?: string; unit?: string; } |
Optional formatting options. |
options.digits? |
number |
- |
options.locale? |
string |
- |
options.unit? |
string |
- |
Returns
Section titled “Returns”string
The formatted area string.
Example
Section titled “Example”import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useTriangle(6, 4); // "12.00"getInstance()
Section titled “getInstance()”static getInstance(): GeometryAreaService;Defined in: core/services/geometry.service.ts:40
Returns the shared instance (Singleton).
Returns
Section titled “Returns”GeometryAreaService