modeling/measurements

All shapes (primitives or the results of operations) can be measured, e.g. calculate volume, etc.

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) measureBoundingSphere(…geometries) → {Array}

Source:
See:

Measure the (aproximate) bounding sphere of the given geometries.

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

the geometries to measure

Returns:

the bounding sphere for each geometry, i.e. [centroid, radius]

Type
Array

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

Source:

Measure the center of the given geometries.

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

the geometries to measure

Returns:

the center point for each geometry, i.e. [X, Y, Z]

Type
Array

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

Source:

Measure the center of mass for the given geometries.

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

the geometries to measure

Returns:

the center of mass for each geometry, i.e. [X, Y, Z]

Type
Array

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

Source:

Measure the dimensions of the given geometries.

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

the geometries to measure

Returns:

the dimensions for each geometry, i.e. [width, depth, height]

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