modeling/hulls

All shapes (primitives or the results of operations) can be passed to hull functions to determine the convex hull of all points. In all cases, the function returns the results, and never changes the original shapes.

Source:
Example
const { hull, hullChain } = require('@jscad/modeling').hulls

Methods

(static) hull(…geometries) → {geom2|geom3}

Source:

Create a convex hull of the given geometries. The given geometries should be of the same type, either geom2 or geom3 or path2.

Examples
let myshape = hull(rectangle({center: [-5,-5]}), ellipse({center: [5,5]}))
+-------+           +-------+
|       |           |        \
|   A   |           |         \
|       |           |          \
+-------+           +           \
                 =   \           \
      +-------+       \           +
      |       |        \          |
      |   B   |         \         |
      |       |          \        |
      +-------+           +-------+
Parameters:
Name Type Attributes Description
geometries Objects <repeatable>

list of geometries from which to create a hull

Returns:

new geometry

Type
geom2 | geom3

(static) hullChain(…geometries) → {geom2|geom3}

Source:

Create a chain of hulled geometries from the given gemetries. Essentially hull A+B, B+C, C+D, etc., then union the results. The given geometries should be of the same type, either geom2 or geom3 or path2.

Examples
let newshape = hullChain(rectangle({center: [-5,-5]}), circle({center: [0,0]}), rectangle({center: [5,5]}))
+-------+   +-------+     +-------+   +------+
|       |   |       |     |        \ /       |
|   A   |   |   C   |     |         |        |
|       |   |       |     |                  |
+-------+   +-------+     +                  +
                      =   \                 /
      +-------+            \               /
      |       |             \             /
      |   B   |              \           /
      |       |               \         /
      +-------+                +-------+
Parameters:
Name Type Attributes Description
geometries Objects <repeatable>

list of geometries from which to create a hull

Returns:

new geometry

Type
geom2 | geom3