@jscad/modeling 3.0.4-alpha.0 → 3.0.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/jscad-modeling.es.js +2 -2
  3. package/dist/jscad-modeling.min.js +2 -2
  4. package/package.json +4 -4
  5. package/rollup.config.js +1 -1
  6. package/src/colors/colorize.js +17 -1
  7. package/src/geometries/geom2/fromPoints.d.ts +4 -0
  8. package/src/geometries/geom2/fromPoints.js +28 -0
  9. package/src/geometries/geom2/fromPoints.test.js +22 -0
  10. package/src/geometries/geom2/index.d.ts +1 -0
  11. package/src/geometries/geom2/index.js +1 -0
  12. package/src/geometries/path3/clone.d.ts +3 -0
  13. package/src/geometries/path3/clone.js +11 -0
  14. package/src/geometries/path3/index.d.ts +1 -0
  15. package/src/geometries/path3/index.js +1 -0
  16. package/src/geometries/poly2/type.d.ts +1 -5
  17. package/src/geometries/slice/fromOutlines.d.ts +5 -0
  18. package/src/geometries/slice/fromOutlines.js +16 -0
  19. package/src/geometries/slice/fromOutlines.test.js +17 -0
  20. package/src/geometries/slice/index.d.ts +1 -1
  21. package/src/geometries/slice/index.js +1 -1
  22. package/src/maths/plane/fromNormalAndPoint.js +4 -6
  23. package/src/maths/plane/fromPoints.js +8 -7
  24. package/src/maths/plane/fromPointsRandom.js +13 -13
  25. package/src/measurements/measureAggregateEpsilon.js +3 -1
  26. package/src/measurements/measureAggregateEpsilon.test.js +1 -1
  27. package/src/measurements/measureArea.js +6 -4
  28. package/src/measurements/measureArea.test.js +4 -1
  29. package/src/measurements/measureBoundingBox.js +16 -2
  30. package/src/measurements/measureBoundingBox.test.js +4 -1
  31. package/src/measurements/measureBoundingSphere.js +38 -29
  32. package/src/measurements/measureBoundingSphere.test.js +4 -1
  33. package/src/measurements/measureCenterOfMass.js +3 -2
  34. package/src/measurements/measureEpsilon.js +4 -2
  35. package/src/operations/booleans/trees/splitPolygonByPlane.d.ts +1 -3
  36. package/src/operations/booleans/union.js +1 -1
  37. package/src/operations/extrusions/extrudeFromSlices.js +1 -1
  38. package/src/operations/extrusions/extrudeFromSlices.test.js +1 -1
  39. package/src/operations/extrusions/extrudeHelical.js +2 -1
  40. package/src/operations/extrusions/extrudeLinear.js +1 -1
  41. package/src/operations/extrusions/extrudeLinearGeom2.js +2 -1
  42. package/src/operations/extrusions/extrudeRotate.js +1 -1
  43. package/src/operations/hulls/hull.js +3 -2
  44. package/src/operations/hulls/toUniquePoints.js +3 -0
  45. package/src/operations/modifiers/generalize.js +9 -2
  46. package/src/operations/modifiers/snap.js +22 -3
  47. package/src/operations/transforms/align.js +2 -1
  48. package/src/operations/transforms/align.test.js +1 -1
  49. package/src/operations/transforms/mirror.js +6 -2
  50. package/src/operations/transforms/rotate.js +6 -2
  51. package/src/operations/transforms/scale.js +6 -2
  52. package/src/operations/transforms/transform.js +6 -2
  53. package/src/operations/transforms/transform.test.js +16 -5
  54. package/src/operations/transforms/translate.js +6 -2
  55. package/src/primitives/arc.js +11 -10
  56. package/src/primitives/circle.js +10 -9
  57. package/src/primitives/cube.js +5 -6
  58. package/src/primitives/cuboid.js +6 -6
  59. package/src/primitives/cylinder.js +8 -8
  60. package/src/primitives/cylinderElliptic.js +11 -11
  61. package/src/primitives/ellipse.js +10 -9
  62. package/src/primitives/ellipsoid.js +8 -8
  63. package/src/primitives/geodesicSphere.js +6 -6
  64. package/src/primitives/line.js +2 -0
  65. package/src/primitives/polygon.js +6 -7
  66. package/src/primitives/polyhedron.js +7 -8
  67. package/src/primitives/rectangle.js +6 -6
  68. package/src/primitives/roundedCuboid.js +8 -8
  69. package/src/primitives/roundedCylinder.js +9 -9
  70. package/src/primitives/roundedRectangle.js +8 -8
  71. package/src/primitives/sphere.js +7 -8
  72. package/src/primitives/square.js +6 -6
  73. package/src/primitives/star.js +10 -10
  74. package/src/primitives/torus.js +11 -11
  75. package/src/primitives/triangle.js +7 -6
  76. package/src/utils/areAllShapesTheSameType.js +4 -0
  77. package/src/geometries/slice/fromGeom2.d.ts +0 -5
  78. package/src/geometries/slice/fromGeom2.js +0 -17
@@ -10,6 +10,7 @@ import { isGTE, isNumberArray } from './commonChecks.js'
10
10
 
11
11
  /**
12
12
  * Construct an axis-aligned ellipse in two dimensional space.
13
+ *
13
14
  * @see https://en.wikipedia.org/wiki/Ellipse
14
15
  * @param {object} [options] - options for construction
15
16
  * @param {Array} [options.center=[0,0]] - center of ellipse
@@ -19,18 +20,18 @@ import { isGTE, isNumberArray } from './commonChecks.js'
19
20
  * @param {number} [options.segments=32] - number of segments to create per full rotation
20
21
  * @returns {Geom2} new 2D geometry
21
22
  * @alias module:modeling/primitives.ellipse
23
+ *
22
24
  * @example
23
25
  * let myshape = ellipse({radius: [5,10]})
24
26
  */
25
- export const ellipse = (options) => {
26
- const defaults = {
27
- center: [0, 0],
28
- radius: [1, 1],
29
- startAngle: 0,
30
- endAngle: TAU,
31
- segments: 32
32
- }
33
- let { center, radius, startAngle, endAngle, segments } = Object.assign({}, defaults, options)
27
+ export const ellipse = (options = {}) => {
28
+ let {
29
+ center = [0, 0],
30
+ radius = [1, 1],
31
+ startAngle = 0,
32
+ endAngle = TAU,
33
+ segments = 32
34
+ } = options
34
35
 
35
36
  if (!isNumberArray(center, 2)) throw new Error('center must be an array of X and Y values')
36
37
  if (!isNumberArray(radius, 2)) throw new Error('radius must be an array of X and Y values')
@@ -9,6 +9,7 @@ import { isGTE, isNumberArray } from './commonChecks.js'
9
9
 
10
10
  /**
11
11
  * Construct an axis-aligned ellipsoid in three dimensional space.
12
+ *
12
13
  * @param {object} [options] - options for construction
13
14
  * @param {Array} [options.center=[0,0,0]] - center of ellipsoid
14
15
  * @param {Array} [options.radius=[1,1,1]] - radius of ellipsoid, along X, Y and Z
@@ -20,14 +21,13 @@ import { isGTE, isNumberArray } from './commonChecks.js'
20
21
  * @example
21
22
  * let myshape = ellipsoid({radius: [5, 10, 20]})
22
23
  */
23
- export const ellipsoid = (options) => {
24
- const defaults = {
25
- center: [0, 0, 0],
26
- radius: [1, 1, 1],
27
- segments: 32,
28
- axes: [[1, 0, 0], [0, -1, 0], [0, 0, 1]]
29
- }
30
- const { center, radius, segments, axes } = Object.assign({}, defaults, options)
24
+ export const ellipsoid = (options = {}) => {
25
+ const {
26
+ center = [0, 0, 0],
27
+ radius = [1, 1, 1],
28
+ segments = 32,
29
+ axes = [[1, 0, 0], [0, -1, 0], [0, 0, 1]]
30
+ } = options
31
31
 
32
32
  if (!isNumberArray(center, 3)) throw new Error('center must be an array of X, Y and Z values')
33
33
  if (!isNumberArray(radius, 3)) throw new Error('radius must be an array of X, Y and Z values')
@@ -8,6 +8,7 @@ import { isGTE } from './commonChecks.js'
8
8
 
9
9
  /**
10
10
  * Construct a geodesic sphere based on icosahedron symmetry.
11
+ *
11
12
  * @param {object} [options] - options for construction
12
13
  * @param {number} [options.radius=1] - target radius of sphere
13
14
  * @param {number} [options.frequency=6] - subdivision frequency per face, multiples of 6
@@ -17,12 +18,11 @@ import { isGTE } from './commonChecks.js'
17
18
  * @example
18
19
  * let myshape = geodesicSphere({radius: 15, frequency: 18})
19
20
  */
20
- export const geodesicSphere = (options) => {
21
- const defaults = {
22
- radius: 1,
23
- frequency: 6
24
- }
25
- let { radius, frequency } = Object.assign({}, defaults, options)
21
+ export const geodesicSphere = (options = {}) => {
22
+ let {
23
+ radius = 1,
24
+ frequency = 6
25
+ } = options
26
26
 
27
27
  if (!isGTE(radius, 0)) throw new Error('radius must be positive')
28
28
  if (!isGTE(frequency, 6)) throw new Error('frequency must be six or more')
@@ -2,7 +2,9 @@ import * as path2 from '../geometries/path2/index.js'
2
2
 
3
3
  /**
4
4
  * Construct a new line in two dimensional space from the given points.
5
+ *
5
6
  * The points must be provided as an array, where each element is a 2D point.
7
+ *
6
8
  * @param {Array} points - array of points from which to create the path
7
9
  * @returns {Path2} new 2D path
8
10
  * @alias module:modeling/primitives.line
@@ -24,13 +24,12 @@ import * as geom2 from '../geometries/geom2/index.js'
24
24
  * or
25
25
  * let poly = polygon({ points: [roof, wall], paths: [[0, 1, 2], [3, 4, 5, 6]] })
26
26
  */
27
- export const polygon = (options) => {
28
- const defaults = {
29
- points: [],
30
- paths: [],
31
- orientation: 'counterclockwise'
32
- }
33
- const { points, paths, orientation } = Object.assign({}, defaults, options)
27
+ export const polygon = (options = {}) => {
28
+ const {
29
+ points = [],
30
+ paths = [],
31
+ orientation = 'counterclockwise'
32
+ } = options
34
33
 
35
34
  if (!(Array.isArray(points) && Array.isArray(paths))) throw new Error('points and paths must be arrays')
36
35
 
@@ -21,14 +21,13 @@ import { isNumberArray } from './commonChecks.js'
21
21
  * let myFaces = [ [0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3] ]
22
22
  * let myShape = polyhedron({points: myPoints, faces: myFaces, orientation: 'inward'})
23
23
  */
24
- export const polyhedron = (options) => {
25
- const defaults = {
26
- points: [],
27
- faces: [],
28
- colors: undefined,
29
- orientation: 'outward'
30
- }
31
- const { points, faces, colors, orientation } = Object.assign({}, defaults, options)
24
+ export const polyhedron = (options = {}) => {
25
+ const {
26
+ points = [],
27
+ faces = [],
28
+ colors = undefined,
29
+ orientation = 'outward'
30
+ } = options
32
31
 
33
32
  if (!(Array.isArray(points) && Array.isArray(faces))) {
34
33
  throw new Error('points and faces must be arrays')
@@ -6,6 +6,7 @@ import { isNumberArray } from './commonChecks.js'
6
6
 
7
7
  /**
8
8
  * Construct an axis-aligned rectangle in two dimensional space with four sides at right angles.
9
+ *
9
10
  * @param {object} [options] - options for construction
10
11
  * @param {Array} [options.center=[0,0]] - center of rectangle
11
12
  * @param {Array} [options.size=[2,2]] - dimension of rectangle, width and length
@@ -15,12 +16,11 @@ import { isNumberArray } from './commonChecks.js'
15
16
  * @example
16
17
  * let myshape = rectangle({size: [10, 20]})
17
18
  */
18
- export const rectangle = (options) => {
19
- const defaults = {
20
- center: [0, 0],
21
- size: [2, 2]
22
- }
23
- const { center, size } = Object.assign({}, defaults, options)
19
+ export const rectangle = (options = {}) => {
20
+ const {
21
+ center = [0, 0],
22
+ size = [2, 2]
23
+ } = options
24
24
 
25
25
  if (!isNumberArray(center, 2)) throw new Error('center must be an array of X and Y values')
26
26
  if (!isNumberArray(size, 2)) throw new Error('size must be an array of X and Y values')
@@ -115,6 +115,7 @@ const stitchSides = (bottomCorners, topCorners) => {
115
115
 
116
116
  /**
117
117
  * Construct an axis-aligned solid cuboid in three dimensional space with rounded corners.
118
+ *
118
119
  * @param {object} [options] - options for construction
119
120
  * @param {Array} [options.center=[0,0,0]] - center of rounded cube
120
121
  * @param {Array} [options.size=[2,2,2]] - dimension of rounded cube; width, depth, height
@@ -126,14 +127,13 @@ const stitchSides = (bottomCorners, topCorners) => {
126
127
  * @example
127
128
  * let myCube = roundedCuboid({size: [10, 20, 10], roundRadius: 2, segments: 16})
128
129
  */
129
- export const roundedCuboid = (options) => {
130
- const defaults = {
131
- center: [0, 0, 0],
132
- size: [2, 2, 2],
133
- roundRadius: 0.2,
134
- segments: 32
135
- }
136
- let { center, size, roundRadius, segments } = Object.assign({}, defaults, options)
130
+ export const roundedCuboid = (options = {}) => {
131
+ let {
132
+ center = [0, 0, 0],
133
+ size = [2, 2, 2],
134
+ roundRadius = 0.2,
135
+ segments = 32
136
+ } = options
137
137
 
138
138
  if (!isNumberArray(center, 3)) throw new Error('center must be an array of X, Y and Z values')
139
139
  if (!isNumberArray(size, 3)) throw new Error('size must be an array of X, Y and Z values')
@@ -12,6 +12,7 @@ import { cylinder } from './cylinder.js'
12
12
 
13
13
  /**
14
14
  * Construct a Z axis-aligned solid cylinder in three dimensional space with rounded ends.
15
+ *
15
16
  * @param {object} [options] - options for construction
16
17
  * @param {Array} [options.center=[0,0,0]] - center of cylinder
17
18
  * @param {number} [options.height=2] - height of cylinder
@@ -24,15 +25,14 @@ import { cylinder } from './cylinder.js'
24
25
  * @example
25
26
  * let myshape = roundedCylinder({ height: 10, radius: 2, roundRadius: 0.5 })
26
27
  */
27
- export const roundedCylinder = (options) => {
28
- const defaults = {
29
- center: [0, 0, 0],
30
- height: 2,
31
- radius: 1,
32
- roundRadius: 0.2,
33
- segments: 32
34
- }
35
- const { center, height, radius, roundRadius, segments } = Object.assign({}, defaults, options)
28
+ export const roundedCylinder = (options = {}) => {
29
+ const {
30
+ center = [0, 0, 0],
31
+ height = 2,
32
+ radius = 1,
33
+ roundRadius = 0.2,
34
+ segments = 32
35
+ } = options
36
36
 
37
37
  if (!isNumberArray(center, 3)) throw new Error('center must be an array of X, Y and Z values')
38
38
  if (!isGTE(height, 0)) throw new Error('height must be positive')
@@ -10,6 +10,7 @@ import { rectangle } from './rectangle.js'
10
10
 
11
11
  /**
12
12
  * Construct an axis-aligned rectangle in two dimensional space with rounded corners.
13
+ *
13
14
  * @param {object} [options] - options for construction
14
15
  * @param {Array} [options.center=[0,0]] - center of rounded rectangle
15
16
  * @param {Array} [options.size=[2,2]] - dimension of rounded rectangle; width and length
@@ -21,14 +22,13 @@ import { rectangle } from './rectangle.js'
21
22
  * @example
22
23
  * let myshape = roundedRectangle({size: [10, 20], roundRadius: 2})
23
24
  */
24
- export const roundedRectangle = (options) => {
25
- const defaults = {
26
- center: [0, 0],
27
- size: [2, 2],
28
- roundRadius: 0.2,
29
- segments: 32
30
- }
31
- let { center, size, roundRadius, segments } = Object.assign({}, defaults, options)
25
+ export const roundedRectangle = (options = {}) => {
26
+ let {
27
+ center = [0, 0],
28
+ size = [2, 2],
29
+ roundRadius = 0.2,
30
+ segments = 32
31
+ } = options
32
32
 
33
33
  if (!isNumberArray(center, 2)) throw new Error('center must be an array of X and Y values')
34
34
  if (!isNumberArray(size, 2)) throw new Error('size must be an array of X and Y values')
@@ -15,14 +15,13 @@ import { isGTE } from './commonChecks.js'
15
15
  * @example
16
16
  * let myshape = sphere({radius: 5})
17
17
  */
18
- export const sphere = (options) => {
19
- const defaults = {
20
- center: [0, 0, 0],
21
- radius: 1,
22
- segments: 32,
23
- axes: [[1, 0, 0], [0, -1, 0], [0, 0, 1]]
24
- }
25
- let { center, radius, segments, axes } = Object.assign({}, defaults, options)
18
+ export const sphere = (options = {}) => {
19
+ let {
20
+ center = [0, 0, 0],
21
+ radius = 1,
22
+ segments = 32,
23
+ axes = [[1, 0, 0], [0, -1, 0], [0, 0, 1]]
24
+ } = options
26
25
 
27
26
  if (!isGTE(radius, 0)) throw new Error('radius must be positive')
28
27
 
@@ -3,6 +3,7 @@ import { isGTE } from './commonChecks.js'
3
3
 
4
4
  /**
5
5
  * Construct an axis-aligned square in two dimensional space with four equal sides at right angles.
6
+ *
6
7
  * @see [rectangle]{@link module:modeling/primitives.rectangle} for more options
7
8
  * @param {object} [options] - options for construction
8
9
  * @param {Array} [options.center=[0,0]] - center of square
@@ -13,12 +14,11 @@ import { isGTE } from './commonChecks.js'
13
14
  * @example
14
15
  * let myshape = square({size: 10})
15
16
  */
16
- export const square = (options) => {
17
- const defaults = {
18
- center: [0, 0],
19
- size: 2
20
- }
21
- let { center, size } = Object.assign({}, defaults, options)
17
+ export const square = (options = {}) => {
18
+ let {
19
+ center = [0, 0],
20
+ size = 2
21
+ } = options
22
22
 
23
23
  if (!isGTE(size, 0)) throw new Error('size must be positive')
24
24
 
@@ -28,6 +28,7 @@ const getPoints = (vertices, radius, startAngle, center) => {
28
28
 
29
29
  /**
30
30
  * Construct a star in two dimensional space.
31
+ *
31
32
  * @see https://en.wikipedia.org/wiki/Star_polygon
32
33
  * @param {object} [options] - options for construction
33
34
  * @param {Array} [options.center=[0,0]] - center of star
@@ -43,16 +44,15 @@ const getPoints = (vertices, radius, startAngle, center) => {
43
44
  * let star1 = star({vertices: 8, outerRadius: 10}) // star with 8/2 density
44
45
  * let star2 = star({vertices: 12, outerRadius: 40, innerRadius: 20}) // star with given radius
45
46
  */
46
- export const star = (options) => {
47
- const defaults = {
48
- center: [0, 0],
49
- vertices: 5,
50
- outerRadius: 1,
51
- innerRadius: 0,
52
- density: 2,
53
- startAngle: 0
54
- }
55
- let { center, vertices, outerRadius, innerRadius, density, startAngle } = Object.assign({}, defaults, options)
47
+ export const star = (options = {}) => {
48
+ let {
49
+ center = [0, 0],
50
+ vertices = 5,
51
+ outerRadius = 1,
52
+ innerRadius = 0,
53
+ density = 2,
54
+ startAngle = 0
55
+ } = options
56
56
 
57
57
  if (!isNumberArray(center, 2)) throw new Error('center must be an array of X and Y values')
58
58
  if (!isGTE(vertices, 2)) throw new Error('vertices must be two or more')
@@ -10,6 +10,7 @@ import { isGT, isGTE } from './commonChecks.js'
10
10
 
11
11
  /**
12
12
  * Construct a torus by revolving a small circle (inner) about the circumference of a large (outer) circle.
13
+ *
13
14
  * @param {object} [options] - options for construction
14
15
  * @param {number} [options.innerRadius=1] - radius of small (inner) circle
15
16
  * @param {number} [options.outerRadius=4] - radius of large (outer) circle
@@ -24,17 +25,16 @@ import { isGT, isGTE } from './commonChecks.js'
24
25
  * @example
25
26
  * let myshape = torus({ innerRadius: 10, outerRadius: 100 })
26
27
  */
27
- export const torus = (options) => {
28
- const defaults = {
29
- innerRadius: 1,
30
- innerSegments: 32,
31
- outerRadius: 4,
32
- outerSegments: 32,
33
- innerRotation: 0,
34
- startAngle: 0,
35
- outerRotation: TAU
36
- }
37
- const { innerRadius, innerSegments, outerRadius, outerSegments, innerRotation, startAngle, outerRotation } = Object.assign({}, defaults, options)
28
+ export const torus = (options = {}) => {
29
+ const {
30
+ innerRadius = 1,
31
+ innerSegments = 32,
32
+ outerRadius = 4,
33
+ outerSegments = 32,
34
+ innerRotation = 0,
35
+ startAngle = 0,
36
+ outerRotation = TAU
37
+ } = options
38
38
 
39
39
  if (!isGT(innerRadius, 0)) throw new Error('innerRadius must be greater than zero')
40
40
  if (!isGTE(innerSegments, 3)) throw new Error('innerSegments must be three or more')
@@ -115,7 +115,9 @@ const createTriangle = (A, B, C, a, b, c) => {
115
115
 
116
116
  /**
117
117
  * Construct a triangle in two dimensional space from the given options.
118
+ *
118
119
  * The triangle is always constructed CCW from the origin, [0, 0, 0].
120
+ *
119
121
  * @see https://www.mathsisfun.com/algebra/trig-solving-triangles.html
120
122
  * @param {object} [options] - options for construction
121
123
  * @param {string} [options.type='SSS'] - type of triangle to construct; A ~ angle, S ~ side
@@ -126,12 +128,11 @@ const createTriangle = (A, B, C, a, b, c) => {
126
128
  * @example
127
129
  * let myshape = triangle({type: 'AAS', values: [degToRad(62), degToRad(35), 7]})
128
130
  */
129
- export const triangle = (options) => {
130
- const defaults = {
131
- type: 'SSS',
132
- values: [1, 1, 1]
133
- }
134
- let { type, values } = Object.assign({}, defaults, options)
131
+ export const triangle = (options = {}) => {
132
+ let {
133
+ type = 'SSS',
134
+ values = [1, 1, 1]
135
+ } = options
135
136
 
136
137
  if (typeof (type) !== 'string') throw new Error('triangle type must be a string')
137
138
  type = type.toUpperCase()
@@ -2,6 +2,8 @@
2
2
  import * as geom2 from '../geometries/geom2/index.js'
3
3
  import * as geom3 from '../geometries/geom3/index.js'
4
4
  import * as path2 from '../geometries/path2/index.js'
5
+ import * as path3 from '../geometries/path3/index.js'
6
+ import * as slice from '../geometries/slice/index.js'
5
7
 
6
8
  /**
7
9
  * @param {Array} shapes - list of shapes to compare
@@ -15,6 +17,8 @@ export const areAllShapesTheSameType = (shapes) => {
15
17
  if (geom2.isA(shape)) currentType = 1
16
18
  if (geom3.isA(shape)) currentType = 2
17
19
  if (path2.isA(shape)) currentType = 3
20
+ if (path3.isA(shape)) currentType = 4
21
+ if (slice.isA(shape)) currentType = 5
18
22
 
19
23
  if (previousType && currentType !== previousType) return false
20
24
  previousType = currentType
@@ -1,5 +0,0 @@
1
- import type { Geom2 } from '../geom2/type.d.ts'
2
-
3
- import type { Slice } from './type.d.ts'
4
-
5
- export function fromGeom2(geometry: Geom2): Slice
@@ -1,17 +0,0 @@
1
- import * as vec3 from '../../maths/vec3/index.js'
2
- import { toOutlines } from '../geom2/index.js'
3
-
4
- import { create } from './create.js'
5
-
6
- /**
7
- * Create a slice from a geom2.
8
- *
9
- * @param {object} geometry - the 2D geometry to create a slice from
10
- * @returns {Slice} a new slice
11
- * @alias module:modeling/slice.fromGeom2
12
- */
13
- export const fromGeom2 = (geometry) => {
14
- // Convert from 2D points to 3D vertices
15
- const contours = toOutlines(geometry).map((outline) => outline.map((point) => vec3.fromVec2(vec3.create(), point)))
16
- return create(contours)
17
- }