Skip to content

GeometryVolumeService

katanakit-js / GeometryVolumeService

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

GeometryVolumeService — pure volume calculations for 3D geometric shapes. All methods are stateless — input → formatted string only.

Applies the Singleton pattern (one shared instance via GeometryVolumeService.getInstance), exposed publicly through the GeometryUtils.volume facade. Every public method uses the use* prefix per CONTRIBUTING.md.

useBox(
length,
width,
height,
options?
): string;

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

Calculates the volume of a box (rectangular prism).

Parameter Type Description
length number The length of the box.
width number The width of the box.
height number The height of the box.
options? { digits?: number; locale?: string; unit?: string; } Optional formatting options.
options.digits? number -
options.locale? string -
options.unit? string -

string

The formatted volume string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useBox(2, 3, 4); // "24.00"

useCone(
radius,
height,
options?
): string;

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

Calculates the volume of a cone.

Parameter Type Description
radius number The radius of the cone base.
height number The height of the cone.
options? { digits?: number; locale?: string; unit?: string; } Optional formatting options.
options.digits? number -
options.locale? string -
options.unit? string -

string

The formatted volume string.

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

useCube(side, options?): string;

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

Calculates the volume of a cube.

Parameter Type Description
side number The side length of the cube.
options? { digits?: number; locale?: string; unit?: string; } Optional formatting options.
options.digits? number -
options.locale? string -
options.unit? string -

string

The formatted volume string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useCube(3); // "27.00"
GeometryUtils.volume.useCube(3, { unit: "m³" }); // "27.00 m³"

useCylinder(
radius,
height,
options?
): string;

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

Calculates the volume of a cylinder.

Parameter Type Description
radius number The radius of the cylinder base.
height number The height of the cylinder.
options? { digits?: number; locale?: string; unit?: string; } Optional formatting options.
options.digits? number -
options.locale? string -
options.unit? string -

string

The formatted volume string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useCylinder(3, 5); // "141.37"

usePyramid(
baseArea,
height,
options?
): string;

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

Calculates the volume of a pyramid.

Parameter Type Description
baseArea number The area of the pyramid base.
height number The height of the pyramid.
options? { digits?: number; locale?: string; unit?: string; } Optional formatting options.
options.digits? number -
options.locale? string -
options.unit? string -

string

The formatted volume string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.usePyramid(12, 5); // "20.00"

useSphere(radius, options?): string;

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

Calculates the volume of a sphere.

Parameter Type Description
radius number The radius of the sphere.
options? { digits?: number; locale?: string; unit?: string; } Optional formatting options.
options.digits? number -
options.locale? string -
options.unit? string -

string

The formatted volume string.

import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useSphere(3); // "113.10"

static getInstance(): GeometryVolumeService;

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

Returns the shared instance (Singleton).

GeometryVolumeService