meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
en:design_guide_measurements [2020/11/28 03:20] JSCAD Editor |
en:design_guide_measurements [2023/06/11 01:10] (current) JSCAD Editor |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Measurements ==== | ==== Measurements ==== | ||
| - | something | + | Sometimes the measurements of a shape can assist when creating a design. This is especially true for shapes imported from external formats. |
| + | |||
| + | <code javascript> | ||
| + | const { measureArea, | ||
| + | </ | ||
| + | |||
| + | === Area === | ||
| + | |||
| + | Measuring the area of a shape is possible, for both 2D and 3D shapes. | ||
| + | |||
| + | <code javascript> | ||
| + | let area = measureArea(sphere()) | ||
| + | </ | ||
| + | |||
| + | //Note: The area for a path is always zero(0) as paths are infinitely thin.// | ||
| + | |||
| + | In addition, the total (aggregate) area for the given geometries can be measured. | ||
| + | |||
| + | <code javascript> | ||
| + | let totalArea = measureAggregateArea(sphere(), | ||
| + | </ | ||
| + | |||
| + | //Note: This measurement will not account for overlapping geometry.// | ||
| + | |||
| + | === Bounding Box === | ||
| + | |||
| + | Measuring the bounding box (min and max bounds) of a shape is possible. | ||
| + | |||
| + | The measureBoundingBox function can be used to retrieve the bounding box of an object, returning an array with two points specifying the minimum and maximum coordinates, | ||
| + | |||
| + | <code javascript> | ||
| + | let bounds = measureBoundingBox(sphere()) | ||
| + | </ | ||
| + | |||
| + | In addition, the total (aggregate) bounding box for the given geometries can be measured. | ||
| + | |||
| + | <code javascript> | ||
| + | let totalBounds = measureAggregateBoundingBox(sphere(), | ||
| + | </ | ||
| + | |||
| + | === Bounding Sphere === | ||
| + | |||
| + | Measuring the (approximate) bounding sphere of a shape is possible. | ||
| + | |||
| + | <code javascript> | ||
| + | let bounds = measureBoundingSphere(cube()) | ||
| + | </ | ||
| + | |||
| + | === Center === | ||
| + | |||
| + | Measuring the center of a shape is possible. | ||
| + | |||
| + | <code javascript> | ||
| + | let center = measureCenter(sphere()) | ||
| + | </ | ||
| + | |||
| + | //Note: This is equivalent to the center of the bounding box.// | ||
| + | |||
| + | === Center of Mass === | ||
| + | |||
| + | Measuring the center of mass of a shape is possible. | ||
| + | |||
| + | <code javascript> | ||
| + | let center = measureCenterOfMass(sphere()) | ||
| + | </ | ||
| + | |||
| + | //Note: The center of mass for a path is always zero(0) as paths are infinitely thin.// | ||
| + | |||
| + | === Dimensions === | ||
| + | |||
| + | Measuring the dimensions of a shape is possible, i.e. width, depth, and height of a shape. | ||
| + | |||
| + | <code javascript> | ||
| + | let dimensions = measureDimensions(sphere()) | ||
| + | </ | ||
| + | |||
| + | //Note: This is the equivalent width, depth, height of the bounding box.// | ||
| + | |||
| + | === Epsilon === | ||
| + | |||
| + | Measuring the epsilon of shapes is possible. Epsilon values are used in various functions to determine minimum distances between points, planes, etc. | ||
| + | |||
| + | <code javascript> | ||
| + | let epsilon = measureEpsilon(sphere()) | ||
| + | </ | ||
| + | |||
| + | In addition, the combined epsilon for a group geometries can be measured. | ||
| + | |||
| + | <code javascript> | ||
| + | let groupEpsilon = measureAggregateEpsilon(sphere(), | ||
| + | </ | ||
| + | |||
| + | === Volume === | ||
| + | |||
| + | Measuring the volume of a shape is possible. | ||
| + | |||
| + | <code javascript> | ||
| + | let volume = measureVolume(sphere()) | ||
| + | </ | ||
| + | |||
| + | //Note: The volume of 2D shapes is always zero(0).// | ||
| + | |||
| + | In addition, the total (aggregate) volume for the given geometries can be measured. | ||
| + | |||
| + | <code javascript> | ||
| + | let totalVolume = measureAggregateVolume(sphere(), | ||
| + | </ | ||
| + | |||
| + | //Note: This measurement will not account for overlapping geometry.// | ||
| - | === Bounds === | ||
| - | The getBounds() function can be used to retrieve the bounding box of an object, returning an array with two points specifying the minimum and maximum coordinates, | ||