Skip to content

GeometryAreaService

katanakit-js / 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.

useCircle(radius, options?): string;

Defined in: core/services/geometry.service.ts:118

Calculates the area of a circle.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useCircle(5); // "78.54"

useEllipse(
semiMajor,
semiMinor,
options?
): string;

Defined in: core/services/geometry.service.ts:180

Calculates the area of an ellipse.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useEllipse(5, 3); // "47.12"

useHexagon(side, options?): string;

Defined in: core/services/geometry.service.ts:161

Calculates the area of a regular hexagon.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useHexagon(3); // "23.38"

useParallelogram(
base,
height,
options?
): string;

Defined in: core/services/geometry.service.ts:199

Calculates the area of a parallelogram.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useParallelogram(6, 4); // "24.00"

useRectangle(
width,
height,
options?
): string;

Defined in: core/services/geometry.service.ts:63

Calculates the area of a rectangle.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useRectangle(5, 10); // "50.00"
GeometryUtils.area.useRectangle(5, 10, { unit: "m²" }); // "50.00 m²"

useSquare(side, options?): string;

Defined in: core/services/geometry.service.ts:81

Calculates the area of a square.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useSquare(4); // "16.00"

useTrapezoid(
parallelSide1,
parallelSide2,
height,
options?
): string;

Defined in: core/services/geometry.service.ts:138

Calculates the area of a trapezoid.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useTrapezoid(3, 5, 4); // "16.00"

useTriangle(
base,
height,
options?
): string;

Defined in: core/services/geometry.service.ts:100

Calculates the area of a triangle.

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 -

string

The formatted area string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useTriangle(6, 4); // "12.00"

static getInstance(): GeometryAreaService;

Defined in: core/services/geometry.service.ts:40

Returns the shared instance (Singleton).

GeometryAreaService