katanakit-js / GeometryUtils
Variable: GeometryUtils
const GeometryUtils: {
area: {
useCircle: string;
useEllipse: string;
useHexagon: string;
useParallelogram: string;
useRectangle: string;
useSquare: string;
useTrapezoid: string;
useTriangle: string;
};
perimeter: {
useCircle: string;
useEllipse: string;
useHexagon: string;
useParallelogram: string;
useRectangle: string;
useSquare: string;
useTrapezoid: string;
useTriangle: string;
};
volume: {
useBox: string;
useCone: string;
useCube: string;
useCylinder: string;
usePyramid: string;
useSphere: string;
};
};Defined in: src/core/services/geometry.service.ts:490
Consolidated pure geometry utilities namespace. Groups area, perimeter and volume calculations (no shared mutable state).
Type Declaration
area
area: {
useCircle: string;
useEllipse: string;
useHexagon: string;
useParallelogram: string;
useRectangle: string;
useSquare: string;
useTrapezoid: string;
useTriangle: string;
};Pure area calculations for geometric shapes. All functions are stateless — input → formatted string only.
Type Declaration
area.useCircle()
useCircle(radius, options?): string;Calculates the area of a circle.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useCircle(5); // "78.54"area.useEllipse()
useEllipse(
semiMajor,
semiMinor,
options?
): string;Calculates the area of an ellipse.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useEllipse(5, 3); // "47.12"area.useHexagon()
useHexagon(side, options?): string;Calculates the area of a regular hexagon.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useHexagon(3); // "23.38"area.useParallelogram()
useParallelogram(
base,
height,
options?
): string;Calculates the area of a parallelogram.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useParallelogram(6, 4); // "24.00"area.useRectangle()
useRectangle(
width,
height,
options?
): string;Calculates the area of a rectangle.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useRectangle(5, 10); // "50.00"
GeometryUtils.area.useRectangle(5, 10, { unit: "m²" }); // "50.00 m²"area.useSquare()
useSquare(side, options?): string;Calculates the area of a square.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useSquare(4); // "16.00"area.useTrapezoid()
useTrapezoid(
parallelSide1,
parallelSide2,
height,
options?
): string;Calculates the area of a trapezoid.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useTrapezoid(3, 5, 4); // "16.00"area.useTriangle()
useTriangle(
base,
height,
options?
): string;Calculates the area of a triangle.
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
string
The formatted area string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useTriangle(6, 4); // "12.00"perimeter
perimeter: {
useCircle: string;
useEllipse: string;
useHexagon: string;
useParallelogram: string;
useRectangle: string;
useSquare: string;
useTrapezoid: string;
useTriangle: string;
};Pure perimeter calculations for geometric shapes. All functions are stateless — input → formatted string only.
Type Declaration
perimeter.useCircle()
useCircle(radius, options?): string;Calculates the perimeter (circumference) of a circle.
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
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useCircle(5); // "31.42"perimeter.useEllipse()
useEllipse(
semiMajor,
semiMinor,
options?
): string;Calculates the perimeter of an ellipse using Ramanujan's approximation II.
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
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useEllipse(5, 3); // "25.53"perimeter.useHexagon()
useHexagon(side, options?): string;Calculates the perimeter of a regular hexagon.
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
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useHexagon(3); // "18.00"perimeter.useParallelogram()
useParallelogram(
side1,
side2,
options?
): string;Calculates the perimeter of a parallelogram.
Parameters
| Parameter | Type | Description |
|---|---|---|
side1 | number | The length of the first side. |
side2 | number | The length of the second side. |
options? | { digits?: number; locale?: string; unit?: string; } | Optional formatting options. |
options.digits? | number | - |
options.locale? | string | - |
options.unit? | string | - |
Returns
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useParallelogram(5, 3); // "16.00"perimeter.useRectangle()
useRectangle(
width,
height,
options?
): string;Calculates the perimeter of a rectangle.
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
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useRectangle(5, 10); // "30.00"
GeometryUtils.perimeter.useRectangle(5, 10, { unit: "m" }); // "30.00 m"perimeter.useSquare()
useSquare(side, options?): string;Calculates the perimeter of a square.
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
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useSquare(4); // "16.00"perimeter.useTrapezoid()
useTrapezoid(
side1,
side2,
side3,
side4,
options?
): string;Calculates the perimeter of a trapezoid.
Parameters
| Parameter | Type | Description |
|---|---|---|
side1 | number | The length of the first side. |
side2 | number | The length of the second side. |
side3 | number | The length of the third side. |
side4 | number | The length of the fourth side. |
options? | { digits?: number; locale?: string; unit?: string; } | Optional formatting options. |
options.digits? | number | - |
options.locale? | string | - |
options.unit? | string | - |
Returns
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useTrapezoid(3, 5, 4, 4); // "16.00"perimeter.useTriangle()
useTriangle(
side1,
side2,
side3,
options?
): string;Calculates the perimeter of a triangle.
Parameters
| Parameter | Type | Description |
|---|---|---|
side1 | number | The length of the first side. |
side2 | number | The length of the second side. |
side3 | number | The length of the third side. |
options? | { digits?: number; locale?: string; unit?: string; } | Optional formatting options. |
options.digits? | number | - |
options.locale? | string | - |
options.unit? | string | - |
Returns
string
The formatted perimeter string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.perimeter.useTriangle(3, 4, 5); // "12.00"volume
volume: {
useBox: string;
useCone: string;
useCube: string;
useCylinder: string;
usePyramid: string;
useSphere: string;
};Pure volume calculations for 3D geometric shapes. All functions are stateless — input → formatted string only.
Type Declaration
volume.useBox()
useBox(
length,
width,
height,
options?
): string;Calculates the volume of a box (rectangular prism).
Parameters
| 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 | - |
Returns
string
The formatted volume string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useBox(2, 3, 4); // "24.00"volume.useCone()
useCone(
radius,
height,
options?
): string;Calculates the volume of a cone.
Parameters
| 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 | - |
Returns
string
The formatted volume string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useCone(3, 5); // "47.12"volume.useCube()
useCube(side, options?): string;Calculates the volume of a cube.
Parameters
| 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 | - |
Returns
string
The formatted volume string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useCube(3); // "27.00"
GeometryUtils.volume.useCube(3, { unit: "m³" }); // "27.00 m³"volume.useCylinder()
useCylinder(
radius,
height,
options?
): string;Calculates the volume of a cylinder.
Parameters
| 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 | - |
Returns
string
The formatted volume string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useCylinder(3, 5); // "141.37"volume.usePyramid()
usePyramid(
baseArea,
height,
options?
): string;Calculates the volume of a pyramid.
Parameters
| 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 | - |
Returns
string
The formatted volume string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.usePyramid(12, 5); // "20.00"volume.useSphere()
useSphere(radius, options?): string;Calculates the volume of a sphere.
Parameters
| 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 | - |
Returns
string
The formatted volume string.
Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.volume.useSphere(3); // "113.10"Example
import { GeometryUtils } from "katanakit-js";
GeometryUtils.area.useCircle(5); // "78.54"
GeometryUtils.perimeter.useCircle(5); // "31.42"
GeometryUtils.volume.useSphere(3); // "113.10"