Saltar al contenido principal

Variable: GeometryUtils

const GeometryUtils: object

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: object

Pure area calculations for geometric shapes. All functions are stateless — input → formatted string only.

area.useCircle()

useCircle(radius, options?): string

Calculates the area of a circle.

Parameters
radius

number

The radius of the circle.

options?

GeometryFormatOptions

Optional formatting options.

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
semiMajor

number

The semi-major axis length.

semiMinor

number

The semi-minor axis length.

options?

GeometryFormatOptions

Optional formatting options.

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
side

number

The side length of the hexagon.

options?

GeometryFormatOptions

Optional formatting options.

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
base

number

The base length of the parallelogram.

height

number

The height of the parallelogram.

options?

GeometryFormatOptions

Optional formatting options.

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
width

number

The width of the rectangle.

height

number

The height of the rectangle.

options?

GeometryFormatOptions

Optional formatting options.

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
side

number

The side length of the square.

options?

GeometryFormatOptions

Optional formatting options.

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
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?

GeometryFormatOptions

Optional formatting options.

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
base

number

The base length of the triangle.

height

number

The height of the triangle.

options?

GeometryFormatOptions

Optional formatting options.

Returns

string

The formatted area string.

Example
import { GeometryUtils } from "katanakit-js";

GeometryUtils.area.useTriangle(6, 4); // "12.00"

perimeter

perimeter: object

Pure perimeter calculations for geometric shapes. All functions are stateless — input → formatted string only.

perimeter.useCircle()

useCircle(radius, options?): string

Calculates the perimeter (circumference) of a circle.

Parameters
radius

number

The radius of the circle.

options?

GeometryFormatOptions

Optional formatting options.

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
semiMajor

number

The semi-major axis length.

semiMinor

number

The semi-minor axis length.

options?

GeometryFormatOptions

Optional formatting options.

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
side

number

The side length of the hexagon.

options?

GeometryFormatOptions

Optional formatting options.

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
side1

number

The length of the first side.

side2

number

The length of the second side.

options?

GeometryFormatOptions

Optional formatting options.

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
width

number

The width of the rectangle.

height

number

The height of the rectangle.

options?

GeometryFormatOptions

Optional formatting options.

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
side

number

The side length of the square.

options?

GeometryFormatOptions

Optional formatting options.

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
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?

GeometryFormatOptions

Optional formatting options.

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
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?

GeometryFormatOptions

Optional formatting options.

Returns

string

The formatted perimeter string.

Example
import { GeometryUtils } from "katanakit-js";

GeometryUtils.perimeter.useTriangle(3, 4, 5); // "12.00"

volume

volume: object

Pure volume calculations for 3D geometric shapes. All functions are stateless — input → formatted string only.

volume.useBox()

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

Calculates the volume of a box (rectangular prism).

Parameters
length

number

The length of the box.

width

number

The width of the box.

height

number

The height of the box.

options?

GeometryFormatOptions

Optional formatting options.

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
radius

number

The radius of the cone base.

height

number

The height of the cone.

options?

GeometryFormatOptions

Optional formatting options.

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
side

number

The side length of the cube.

options?

GeometryFormatOptions

Optional formatting options.

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
radius

number

The radius of the cylinder base.

height

number

The height of the cylinder.

options?

GeometryFormatOptions

Optional formatting options.

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
baseArea

number

The area of the pyramid base.

height

number

The height of the pyramid.

options?

GeometryFormatOptions

Optional formatting options.

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
radius

number

The radius of the sphere.

options?

GeometryFormatOptions

Optional formatting options.

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"