modeling/measurements

All shapes (primitives or the results of operations) can be measured, e.g. calculate volume, etc. In all cases, the function returns the results, and never changes the original shapes.

Source:
Example
const { measureArea, measureBoundingBox, measureVolume } = require('@jscad/modeling').measurements

Methods

(static) measureAggregateArea(…geometries) → {Number}

Source:

Measure the total (aggregate) area for the given geometries. Note: This measurement will not account for overlapping geometry

Example
let totalArea = measureAggregateArea(sphere(),cube())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure.

Returns:

the total surface area for the group of geometry.

Type
Number

(static) measureAggregateBoundingBox(…geometries) → {Array}

Source:

Measure the aggregated minimum and maximum bounds for the given geometries.

Example
let bounds = measureAggregateBoundingBox(sphere(),cube())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure

Returns:

the min and max bounds for the group of geometry, i.e. [[x,y,z],[X,Y,Z]]

Type
Array

(static) measureAggregateEpsilon(…geometries) → {Number}

Source:

Measure the aggregated Epsilon for the given geometries.

Example
let groupEpsilon = measureAggregateEpsilon(sphere(),cube())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure

Returns:

the aggregated Epsilon for the whole group of geometries

Type
Number

(static) measureAggregateVolume(…geometries) → {Number}

Source:

Measure the total (aggregate) volume for the given geometries. Note: This measurement will not account for overlapping geometry

Example
let totalVolume = measureAggregateVolume(sphere(),cube())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure.

Returns:

the volume for the group of geometry.

Type
Number

(static) measureArea(…geometries) → {Number|Array}

Source:

Measure the area of the given geometries.

Example
let area = measureArea(sphere())
Parameters:
Name Type Attributes Description
geometries Objects <repeatable>

the geometries to measure

Returns:

the area, or a list of areas for each geometry

Type
Number | Array

(static) measureBoundingBox(…geometries) → {Array}

Source:

Measure the min and max bounds of the given geometries.

Example
let bounds = measureBoundingBox(sphere())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure

Returns:

the min and max bounds, or a list of bounds for each geometry

Type
Array

(static) measureEpsilon(…geometries) → {Number|Array}

Source:

Measure the epsilon of the given geometries. Epsilon values are used in various functions to determine minimum distances between points, planes, etc.

Example
let epsilon = measureEpsilon(sphere())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure

Returns:

the epsilon, or a list of epsilons for each geometry

Type
Number | Array

(static) measureVolume(…geometries) → {Number|Array}

Source:

Measure the volume of the given geometries.

Example
let volume = measureVolume(sphere())
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

the geometries to measure

Returns:

the volume, or a list of volumes for each geometry

Type
Number | Array