meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:design_guide_measurements [2023/06/11 01:00]
JSCAD Editor
en:design_guide_measurements [2023/06/11 01:10] (current)
JSCAD Editor
Line 2: Line 2:
  
 Sometimes the measurements of a shape can assist when creating a design. This is especially true for shapes imported from external formats. 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, measureBoundingBox, measureVolume } = require('@jscad/modeling').measurements
 +</code>
  
 === Area === === Area ===
Line 40: Line 44:
  
 Measuring the (approximate) bounding sphere of a shape is possible. Measuring the (approximate) bounding sphere of a shape is possible.
 +
 +<code javascript>
 +let bounds = measureBoundingSphere(cube())
 +</code>
  
 === Center === === Center ===
  
 Measuring the center of a shape is possible. Measuring the center of a shape is possible.
 +
 +<code javascript>
 +let center = measureCenter(sphere())
 +</code>
  
 //Note: This is equivalent to the center of the bounding box.// //Note: This is equivalent to the center of the bounding box.//
Line 50: Line 62:
  
 Measuring the center of mass of a shape is possible. Measuring the center of mass of a shape is possible.
 +
 +<code javascript>
 +let center = measureCenterOfMass(sphere())
 +</code>
  
 //Note: The center of mass for a path is always zero(0) as paths are infinitely thin.// //Note: The center of mass for a path is always zero(0) as paths are infinitely thin.//
Line 55: Line 71:
 === Dimensions === === Dimensions ===
  
-Measuring the dimensions of a shape is possible.+Measuring the dimensions of a shape is possible, i.e. width, depth, and height of a shape. 
 + 
 +<code javascript> 
 +let dimensions = measureDimensions(sphere()) 
 +</code>
  
 //Note: This is the equivalent width, depth, height of the bounding box.// //Note: This is the equivalent width, depth, height of the bounding box.//
Line 62: Line 82:
  
 Measuring the epsilon of shapes is possible. Epsilon values are used in various functions to determine minimum distances between points, planes, etc. 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())
 +</code>
 +
 +In addition, the combined epsilon for a group geometries can be measured.
 +
 +<code javascript>
 +let groupEpsilon = measureAggregateEpsilon(sphere(),cube())
 +</code>
  
 === Volume === === Volume ===
  
 Measuring the volume of a shape is possible. Measuring the volume of a shape is possible.
 +
 +<code javascript>
 +let volume = measureVolume(sphere())
 +</code>
  
 //Note: The volume of 2D shapes is always zero(0).// //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(),cube())
 +</code>
 +
 +//Note: This measurement will not account for overlapping geometry.//
 +
 +
 +