Skip to main content

measurements

modeling/measurements

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

Example

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

modeling/measurements.measureAggregateArea(...geometries)

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

Kind: static method of modeling/measurements
Returns: Number - the total surface area for the group of geometry.

ParamTypeDescription
...geometriesObjectthe geometries to measure.

Example

let totalArea = measureAggregateArea(sphere(),cube())

modeling/measurements.measureAggregateBoundingBox(...geometries)

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

Kind: static method of modeling/measurements
Returns: Array - the min and max bounds for the group of geometry, i.e. [[x,y,z],[X,Y,Z]]

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let bounds = measureAggregateBoundingBox(sphere(),cube())

modeling/measurements.measureAggregateEpsilon(...geometries)

Measure the aggregated Epsilon for the given geometries.

Kind: static method of modeling/measurements
Returns: Number - the aggregated Epsilon for the whole group of geometries

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let groupEpsilon = measureAggregateEpsilon(sphere(),cube())

modeling/measurements.measureAggregateVolume(...geometries)

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

Kind: static method of modeling/measurements
Returns: Number - the volume for the group of geometry.

ParamTypeDescription
...geometriesObjectthe geometries to measure.

Example

let totalVolume = measureAggregateVolume(sphere(),cube())

modeling/measurements.measureArea(...geometries)

Measure the area of the given geometries.

Kind: static method of modeling/measurements
Returns: NumberArray - the area, or a list of areas for each geometry

ParamTypeDescription
...geometriesObjectsthe geometries to measure

Example

let area = measureArea(sphere())

modeling/measurements.measureBoundingBox(...geometries)

Measure the min and max bounds of the given geometries.

Kind: static method of modeling/measurements
Returns: Array - the min and max bounds, or a list of bounds for each geometry

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let bounds = measureBoundingBox(sphere())

modeling/measurements.measureBoundingSphere(...geometries)

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

Kind: static method of modeling/measurements
Returns: Array - the bounding sphere for each geometry, i.e. [centroid, radius]
See: https://en.wikipedia.org/wiki/Bounding_sphere

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let bounds = measureBoundingSphere(cube())

modeling/measurements.measureCenter(...geometries)

Measure the center of the given geometries.

Kind: static method of modeling/measurements
Returns: Array - the center point for each geometry, i.e. [X, Y, Z]

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let center = measureCenter(sphere())

modeling/measurements.measureCenterOfMass(...geometries)

Measure the center of mass for the given geometries.

Kind: static method of modeling/measurements
Returns: Array - the center of mass for each geometry, i.e. [X, Y, Z]

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let center = measureCenterOfMass(sphere())

modeling/measurements.measureDimensions(...geometries)

Measure the dimensions of the given geometries.

Kind: static method of modeling/measurements
Returns: Array - the dimensions for each geometry, i.e. [width, depth, height]

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let dimensions = measureDimensions(sphere())

modeling/measurements.measureEpsilon(...geometries)

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

Kind: static method of modeling/measurements
Returns: NumberArray - the epsilon, or a list of epsilons for each geometry

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let epsilon = measureEpsilon(sphere())

modeling/measurements.measureVolume(...geometries)

Measure the volume of the given geometries.

Kind: static method of modeling/measurements
Returns: NumberArray - the volume, or a list of volumes for each geometry

ParamTypeDescription
...geometriesObjectthe geometries to measure

Example

let volume = measureVolume(sphere())