@jscad/x3d-deserializer 2.2.5 → 3.0.0-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.
package/src/objects.js CHANGED
@@ -1,6 +1,6 @@
1
- const { maths } = require('@jscad/modeling')
1
+ import { poly2 } from '@jscad/modeling'
2
2
 
3
- const x3dTypes = {
3
+ export const x3dTypes = {
4
4
  X3D: 0,
5
5
  UNIT: 1,
6
6
  META: 2,
@@ -43,14 +43,14 @@ const x3dTypes = {
43
43
  }
44
44
 
45
45
  // document level node, basically a group
46
- const x3dX3D = (element) => {
46
+ export const x3dX3D = (element) => {
47
47
  const obj = { definition: x3dTypes.X3D }
48
48
 
49
49
  obj.objects = []
50
50
  return obj
51
51
  }
52
52
 
53
- const x3dUnit = (element) => {
53
+ export const x3dUnit = (element) => {
54
54
  const obj = { definition: x3dTypes.UNIT, category: '', name: '', conversionFactor: 1.0 }
55
55
 
56
56
  if (element.category) obj.category = element.category
@@ -60,7 +60,7 @@ const x3dUnit = (element) => {
60
60
  return obj
61
61
  }
62
62
 
63
- const x3dMeta = (element) => {
63
+ export const x3dMeta = (element) => {
64
64
  const obj = { definition: x3dTypes.META, content: '', name: '' }
65
65
 
66
66
  if (element.content) obj.content = element.content
@@ -70,7 +70,7 @@ const x3dMeta = (element) => {
70
70
  }
71
71
 
72
72
  // scenes contain various other nodes, basically a group
73
- const x3dScene = (element) => {
73
+ export const x3dScene = (element) => {
74
74
  const obj = { definition: x3dTypes.SCENE }
75
75
  obj.objects = []
76
76
  return obj
@@ -78,7 +78,7 @@ const x3dScene = (element) => {
78
78
 
79
79
  // transforms contain various other nodes, basically a group
80
80
  // horrific order of transforms... see http://edutechwiki.unige.ch/en/X3D_grouping_and_transforms
81
- const x3dTransform = (element) => {
81
+ export const x3dTransform = (element) => {
82
82
  const obj = {
83
83
  definition: x3dTypes.TRANSFORM,
84
84
  center: [0, 0, 0],
@@ -124,7 +124,7 @@ const x3dTransform = (element) => {
124
124
  }
125
125
 
126
126
  // shapes contain geometry and appearance, in any order
127
- const x3dShape = (element) => {
127
+ export const x3dShape = (element) => {
128
128
  const obj = { definition: x3dTypes.SHAPE }
129
129
  obj.objects = []
130
130
  return obj
@@ -134,7 +134,7 @@ const x3dShape = (element) => {
134
134
  // 3D shapes
135
135
  //
136
136
 
137
- const x3dBox = (element) => {
137
+ export const x3dBox = (element) => {
138
138
  const obj = { definition: x3dTypes.BOX, size: [2, 2, 2] }
139
139
 
140
140
  if (element.size) {
@@ -146,7 +146,7 @@ const x3dBox = (element) => {
146
146
  return obj
147
147
  }
148
148
 
149
- const x3dCone = (element) => {
149
+ export const x3dCone = (element) => {
150
150
  const NEAR0 = 0.00001
151
151
  const obj = { definition: x3dTypes.CONE, bottomRadius: 1, height: 2, subdivision: 32, topRadius: NEAR0 }
152
152
 
@@ -165,7 +165,7 @@ const x3dCone = (element) => {
165
165
  return obj
166
166
  }
167
167
 
168
- const x3dCylinder = (element) => {
168
+ export const x3dCylinder = (element) => {
169
169
  const obj = { definition: x3dTypes.CYLINDER, height: 2, radius: 1, subdivision: 32 }
170
170
 
171
171
  if (element.height) {
@@ -180,7 +180,7 @@ const x3dCylinder = (element) => {
180
180
  return obj
181
181
  }
182
182
 
183
- const x3dSphere = (element) => {
183
+ export const x3dSphere = (element) => {
184
184
  const obj = { definition: x3dTypes.SPHERE, radius: 1, subdivision: 24 }
185
185
 
186
186
  if (element.radius) {
@@ -195,7 +195,7 @@ const x3dSphere = (element) => {
195
195
  return obj
196
196
  }
197
197
 
198
- const x3dExtrusion = (element) => {
198
+ export const x3dExtrusion = (element) => {
199
199
  const obj = {
200
200
  definition: x3dTypes.EXTRUSION,
201
201
  ccw: true,
@@ -224,7 +224,7 @@ const x3dExtrusion = (element) => {
224
224
  const vi = i * 2
225
225
  points.push([values[vi], values[vi + 1]])
226
226
  }
227
- obj.ccw = (maths.utils.area(points) < 0) // WHAT!!!! X3D IS SICK!!!
227
+ obj.ccw = (poly2.measureArea(poly2.create(points)) < 0) // WHAT!!!! X3D IS SICK!!!
228
228
  obj.crossSection = points
229
229
  }
230
230
  if (element.orientation) {
@@ -267,7 +267,7 @@ const x3dExtrusion = (element) => {
267
267
  // 2D shapes
268
268
  //
269
269
 
270
- const x3dArc2D = (element) => {
270
+ export const x3dArc2D = (element) => {
271
271
  const obj = { definition: x3dTypes.ARC2D, endAngle: Math.PI / 2, radius: 1, startAngle: 0, subdivision: 32 }
272
272
 
273
273
  if (element.endAngle) {
@@ -285,7 +285,7 @@ const x3dArc2D = (element) => {
285
285
  return obj
286
286
  }
287
287
 
288
- const x3dArcClose2D = (element) => {
288
+ export const x3dArcClose2D = (element) => {
289
289
  const obj = { definition: x3dTypes.ARCCLOSE2D, closureType: 'PIE', endAngle: Math.PI / 2, radius: 1, startAngle: 0, subdivision: 32 }
290
290
 
291
291
  if (element.closureType) {
@@ -306,7 +306,7 @@ const x3dArcClose2D = (element) => {
306
306
  return obj
307
307
  }
308
308
 
309
- const x3dCircle2D = (element) => {
309
+ export const x3dCircle2D = (element) => {
310
310
  const obj = { definition: x3dTypes.CIRCLE2D, radius: 1, subdivision: 32 }
311
311
 
312
312
  if (element.radius) {
@@ -318,7 +318,7 @@ const x3dCircle2D = (element) => {
318
318
  return obj
319
319
  }
320
320
 
321
- const x3dDisk2D = (element) => {
321
+ export const x3dDisk2D = (element) => {
322
322
  const obj = { definition: x3dTypes.DISK2D, innerRadius: 0, outerRadius: 1, subdivision: 32 }
323
323
 
324
324
  if (element.innerRadius) {
@@ -333,7 +333,7 @@ const x3dDisk2D = (element) => {
333
333
  return obj
334
334
  }
335
335
 
336
- const x3dPolyline2D = (element) => {
336
+ export const x3dPolyline2D = (element) => {
337
337
  const obj = { definition: x3dTypes.POLYLINE2D, lineSegments: [] }
338
338
 
339
339
  if (element.lineSegments) {
@@ -346,7 +346,7 @@ const x3dPolyline2D = (element) => {
346
346
  return obj
347
347
  }
348
348
 
349
- const x3dRectangle2D = (element) => {
349
+ export const x3dRectangle2D = (element) => {
350
350
  const obj = { definition: x3dTypes.RECTANGLE2D, size: [2, 2] }
351
351
 
352
352
  if (element.size) {
@@ -358,7 +358,7 @@ const x3dRectangle2D = (element) => {
358
358
  return obj
359
359
  }
360
360
 
361
- const x3dTriangleSet2D = (element) => {
361
+ export const x3dTriangleSet2D = (element) => {
362
362
  const obj = { definition: x3dTypes.TRIANGLESET2D, vertices: [] }
363
363
 
364
364
  if (element.vertices) {
@@ -375,7 +375,7 @@ const x3dTriangleSet2D = (element) => {
375
375
  // Lines
376
376
  //
377
377
 
378
- const x3dLineSet = (element) => {
378
+ export const x3dLineSet = (element) => {
379
379
  const obj = { definition: x3dTypes.LINESET, vertexCount: [], colorPerVertex: true }
380
380
 
381
381
  if (element.vertexCount) {
@@ -389,7 +389,7 @@ const x3dLineSet = (element) => {
389
389
  return obj
390
390
  }
391
391
 
392
- const x3dIndexedLineSet = (element) => {
392
+ export const x3dIndexedLineSet = (element) => {
393
393
  const obj = { definition: x3dTypes.INDEXEDLINESET, indexes: [], colorPerVertex: true }
394
394
 
395
395
  if (element.coordIndex) {
@@ -409,7 +409,7 @@ const x3dIndexedLineSet = (element) => {
409
409
  // Meshs
410
410
  //
411
411
 
412
- const x3dColor = (element) => {
412
+ export const x3dColor = (element) => {
413
413
  const obj = { definition: x3dTypes.COLOR, colors: [] }
414
414
 
415
415
  if (element.color) {
@@ -424,7 +424,7 @@ const x3dColor = (element) => {
424
424
  return obj
425
425
  }
426
426
 
427
- const x3dCoordinate = (element) => {
427
+ export const x3dCoordinate = (element) => {
428
428
  const obj = { definition: x3dTypes.COORDINATE, points: [] }
429
429
 
430
430
  if (element.point) {
@@ -439,7 +439,7 @@ const x3dCoordinate = (element) => {
439
439
  return obj
440
440
  }
441
441
 
442
- const x3dTriangleSet = (element) => {
442
+ export const x3dTriangleSet = (element) => {
443
443
  const obj = { definition: x3dTypes.TRIANGLESET, ccw: true, colorPerVertex: true }
444
444
 
445
445
  if (element.ccw) {
@@ -449,7 +449,7 @@ const x3dTriangleSet = (element) => {
449
449
  return obj
450
450
  }
451
451
 
452
- const x3dTriangleFanSet = (element) => {
452
+ export const x3dTriangleFanSet = (element) => {
453
453
  const obj = { definition: x3dTypes.TRIANGLEFANSET, ccw: true, fanCount: [], colorPerVertex: true }
454
454
 
455
455
  if (element.ccw) {
@@ -462,7 +462,7 @@ const x3dTriangleFanSet = (element) => {
462
462
  return obj
463
463
  }
464
464
 
465
- const x3dTriangleStripSet = (element) => {
465
+ export const x3dTriangleStripSet = (element) => {
466
466
  const obj = { definition: x3dTypes.TRIANGLESTRIPSET, ccw: true, stripCount: [], colorPerVertex: true }
467
467
 
468
468
  if (element.ccw) {
@@ -475,7 +475,7 @@ const x3dTriangleStripSet = (element) => {
475
475
  return obj
476
476
  }
477
477
 
478
- const x3dQuadSet = (element) => {
478
+ export const x3dQuadSet = (element) => {
479
479
  const obj = { definition: x3dTypes.QUADSET, ccw: true, colorPerVertex: true }
480
480
 
481
481
  if (element.ccw) {
@@ -485,7 +485,7 @@ const x3dQuadSet = (element) => {
485
485
  return obj
486
486
  }
487
487
 
488
- const x3dIndexedTriangleSet = (element) => {
488
+ export const x3dIndexedTriangleSet = (element) => {
489
489
  const obj = { definition: x3dTypes.INDEXEDTRIANGLESET, ccw: true, index: [], colorPerVertex: true }
490
490
 
491
491
  if (element.ccw) {
@@ -498,7 +498,7 @@ const x3dIndexedTriangleSet = (element) => {
498
498
  return obj
499
499
  }
500
500
 
501
- const x3dIndexedTriangleFanSet = (element) => {
501
+ export const x3dIndexedTriangleFanSet = (element) => {
502
502
  const obj = { definition: x3dTypes.INDEXEDTRIANGLEFANSET, ccw: true, fans: [], colorPerVertex: true }
503
503
 
504
504
  if (element.ccw) {
@@ -512,7 +512,7 @@ const x3dIndexedTriangleFanSet = (element) => {
512
512
  return obj
513
513
  }
514
514
 
515
- const x3dIndexedTriangleStripSet = (element) => {
515
+ export const x3dIndexedTriangleStripSet = (element) => {
516
516
  const obj = { definition: x3dTypes.INDEXEDTRIANGLESTRIPSET, ccw: true, strips: [], colorPerVertex: true }
517
517
 
518
518
  obj.objects = []
@@ -526,7 +526,7 @@ const x3dIndexedTriangleStripSet = (element) => {
526
526
  return obj
527
527
  }
528
528
 
529
- const x3dIndexedQuadSet = (element) => {
529
+ export const x3dIndexedQuadSet = (element) => {
530
530
  const obj = { definition: x3dTypes.INDEXEDQUADSET, ccw: true, index: [], colorPerVertex: true }
531
531
 
532
532
  if (element.ccw) {
@@ -539,7 +539,7 @@ const x3dIndexedQuadSet = (element) => {
539
539
  return obj
540
540
  }
541
541
 
542
- const x3dIndexedFaceSet = (element) => {
542
+ export const x3dIndexedFaceSet = (element) => {
543
543
  const obj = { definition: x3dTypes.INDEXEDFACESET, ccw: true, convex: true, faces: [], colorPerVertex: true, colorIndex: null }
544
544
 
545
545
  if (element.ccw) {
@@ -573,7 +573,7 @@ const x3dIndexedFaceSet = (element) => {
573
573
  return obj
574
574
  }
575
575
 
576
- const x3dElevationGrid = (element) => {
576
+ export const x3dElevationGrid = (element) => {
577
577
  const obj = { definition: x3dTypes.ELEVATIONGRID, xDimension: 2, zDimension: 2, xSpacing: 1.0, zSpacing: 1.0, height: [0, 0, 0, 0], ccw: true, solid: false, colorPerVertex: true }
578
578
 
579
579
  if (element.xDimension) {
@@ -610,14 +610,14 @@ const x3dElevationGrid = (element) => {
610
610
  // Materials
611
611
  //
612
612
 
613
- const x3dAppearance = (element) => {
613
+ export const x3dAppearance = (element) => {
614
614
  const obj = { definition: x3dTypes.APPEARANCE }
615
615
 
616
616
  obj.objects = []
617
617
  return obj
618
618
  }
619
619
 
620
- const x3dMaterial = (element) => {
620
+ export const x3dMaterial = (element) => {
621
621
  const obj = { definition: x3dTypes.MATERIAL, color: [0.8, 0.8, 0.8, 1.0] }
622
622
 
623
623
  // convert material to colors if possible
@@ -650,54 +650,9 @@ const x3dMaterial = (element) => {
650
650
 
651
651
  // GROUPS
652
652
 
653
- const x3dGroup = (element) => {
653
+ export const x3dGroup = (element) => {
654
654
  const obj = { definition: x3dTypes.GROUP }
655
655
 
656
656
  obj.objects = []
657
657
  return obj
658
658
  }
659
-
660
- module.exports = {
661
- x3dTypes,
662
-
663
- x3dX3D,
664
- x3dUnit,
665
- x3dMeta,
666
- x3dScene,
667
- x3dTransform,
668
- x3dShape,
669
- x3dGroup,
670
-
671
- x3dBox,
672
- x3dCone,
673
- x3dCylinder,
674
- x3dSphere,
675
- x3dExtrusion,
676
-
677
- x3dArc2D,
678
- x3dArcClose2D,
679
- x3dCircle2D,
680
- x3dDisk2D,
681
- x3dPolyline2D,
682
- x3dRectangle2D,
683
- x3dTriangleSet2D,
684
-
685
- x3dColor,
686
- x3dCoordinate,
687
- x3dTriangleSet,
688
- x3dTriangleFanSet,
689
- x3dTriangleStripSet,
690
- x3dQuadSet,
691
- x3dIndexedTriangleSet,
692
- x3dIndexedTriangleFanSet,
693
- x3dIndexedTriangleStripSet,
694
- x3dIndexedQuadSet,
695
- x3dIndexedFaceSet,
696
- x3dElevationGrid,
697
-
698
- x3dLineSet,
699
- x3dIndexedLineSet,
700
-
701
- x3dAppearance,
702
- x3dMaterial
703
- }
package/src/parse.js CHANGED
@@ -1,6 +1,6 @@
1
- const saxes = require('saxes')
1
+ import * as saxes from 'saxes'
2
2
 
3
- const {
3
+ import {
4
4
  x3dTypes,
5
5
 
6
6
  x3dX3D,
@@ -43,10 +43,10 @@ const {
43
43
 
44
44
  x3dAppearance,
45
45
  x3dMaterial
46
- } = require('./objects')
46
+ } from './objects.js'
47
47
 
48
48
  let x3dLast = null // last object found
49
- let x3dDefinition = x3dTypes.X3D // what kind of object beinging created
49
+ let x3dDefinition = x3dTypes.X3D // what kind of object being created
50
50
 
51
51
  // high level elements / definitions
52
52
  const x3dObjects = [] // list of objects
@@ -107,7 +107,7 @@ const nodeToObjectMap = {
107
107
  let objectId = 1
108
108
  const getObjectId = () => ('0000' + objectId++).slice(-4)
109
109
 
110
- const createX3DParser = (src, pxPmm) => {
110
+ const createX3DParser = (src) => {
111
111
  // create a parser for the XML
112
112
  const parser = new saxes.SaxesParser()
113
113
 
@@ -333,10 +333,8 @@ const createX3DParser = (src, pxPmm) => {
333
333
  parser.write(src).close()
334
334
  }
335
335
 
336
- const parse = (src, pxPmm) => {
337
- createX3DParser(src, pxPmm)
336
+ export const parse = (src) => {
337
+ createX3DParser(src)
338
338
  // console.log(JSON.stringify(x3dObj))
339
339
  return { x3dObj, x3dMaterials, x3dTextures }
340
340
  }
341
-
342
- module.exports = parse
package/src/translate.js CHANGED
@@ -1,19 +1,17 @@
1
- const translateDefinitions = require('./translateDefinitions')
1
+ import { translateDefinitions } from './translateDefinitions.js'
2
+ import { x3dTypes } from './objects.js'
3
+ import { parse } from './parse.js'
2
4
 
3
- const { x3dTypes } = require('./objects')
4
- const parse = require('./parse')
5
-
6
- const translate = (options, src) => {
5
+ export const translate = (options, src) => {
7
6
  const defaults = {
8
- pxPmm: require('./constants').pxPmm
9
7
  }
10
8
  options = Object.assign({}, defaults, options)
11
- const { version, pxPmm, addMetaData, filename } = options
9
+ const { version, addMetaData, filename } = options
12
10
 
13
11
  options && options.statusCallback && options.statusCallback({ progress: 0 })
14
12
 
15
13
  // parse the X3D source
16
- const { x3dObj, x3dMaterials, x3dTextures } = parse(src, pxPmm)
14
+ const { x3dObj, x3dMaterials, x3dTextures } = parse(src)
17
15
 
18
16
  // convert the internal objects to JSCAD code
19
17
  let code = addMetaData
@@ -58,22 +56,9 @@ const codify = (x3d, data) => {
58
56
  // Units : ${length.name} (${length.factor})
59
57
  // Angles : ${angle.name} (${angle.factor})
60
58
 
61
- const {booleans, extrusions, geometries, maths, primitives, transforms, utils} = require('@jscad/modeling')
62
- const { colorize } = require('@jscad/modeling').colors
63
-
64
- const applyTransform = (matrix, ...objects) => {
65
- objects = utils.flatten(objects)
66
- if (objects.length === 0) return objects
67
-
68
- return objects.map((object) => {
69
- const color = object.color
70
- object = transforms.transform(matrix, object)
71
- if (color) object.color = color
72
- return object
73
- })
74
- }
59
+ import * from '@jscad/modeling'
75
60
 
76
- const main = () => {
61
+ export const main = () => {
77
62
  let options = {}
78
63
  let objects = []
79
64
  `
@@ -87,9 +72,5 @@ const main = () => {
87
72
 
88
73
  code += translateDefinitions({}, objects)
89
74
 
90
- code += 'module.exports = {main}\n'
91
-
92
75
  return code
93
76
  }
94
-
95
- module.exports = translate
@@ -1,8 +1,8 @@
1
- const createTransform = require('./createTransform')
1
+ import { createTransform } from './createTransform.js'
2
2
 
3
- const { x3dTypes } = require('./objects')
3
+ import { x3dTypes } from './objects.js'
4
4
 
5
- const translateShape = require('./translateShape')
5
+ import { translateShape } from './translateShape.js'
6
6
 
7
7
  // horrific order of transforms... see http://edutechwiki.unige.ch/en/X3D_grouping_and_transforms
8
8
  const translateTransform = (options, object) => {
@@ -23,7 +23,7 @@ const createObjects${object.id} = (options) => {
23
23
  // apply the transforms if any
24
24
  code += `
25
25
  const matrix = [${matrix}]
26
- return applyTransform(matrix, objects)
26
+ return transform(matrix, objects)
27
27
  }
28
28
  `
29
29
 
@@ -81,6 +81,4 @@ const translateDefinition = (options, object) => {
81
81
  }
82
82
 
83
83
  // convert the given X3D objects into a series of JSCAD function definitions
84
- const translateDefinitions = (options, objects) => objects.reduce((code, object, index) => code += translateDefinition(options, object), '')
85
-
86
- module.exports = translateDefinitions
84
+ export const translateDefinitions = (options, objects) => objects.reduce((code, object, index) => code += translateDefinition(options, object), '')
@@ -1,8 +1,8 @@
1
- const { x3dTypes } = require('./objects')
1
+ import { x3dTypes } from './objects.js'
2
2
 
3
- const findNode = (x3dtype, objects) => objects.find((object) => object.definition === x3dtype)
3
+ export const findNode = (x3dtype, objects) => objects.find((object) => object.definition === x3dtype)
4
4
 
5
- const findColor = (objects, options) => {
5
+ export const findColor = (objects, options) => {
6
6
  const appearance = findNode(x3dTypes.APPEARANCE, objects)
7
7
  let material
8
8
  if (appearance) {
@@ -19,9 +19,9 @@ const findColor = (objects, options) => {
19
19
  return null
20
20
  }
21
21
 
22
- const pointToString = (point) => `[${point}]`
22
+ export const pointToString = (point) => `[${point}]`
23
23
 
24
- const pointsToString = (triangle) => {
24
+ export const pointsToString = (triangle) => {
25
25
  const strings = triangle.map((point) => pointToString(point))
26
26
  return `[
27
27
  ${strings.join(',\n ')}
@@ -66,7 +66,7 @@ const createColorsFromFaceColors = (colorIndex, faceColors) => {
66
66
  }
67
67
 
68
68
  // create a list of colors from the given shape and color objects
69
- const createColors = (shape, color) => {
69
+ export const createColors = (shape, color) => {
70
70
  if (!color) return null
71
71
  if (!Array.isArray(shape.colorIndex)) return null
72
72
 
@@ -78,13 +78,3 @@ const createColors = (shape, color) => {
78
78
  }
79
79
  return colors
80
80
  }
81
-
82
- module.exports = {
83
- findNode,
84
- findColor,
85
-
86
- createColors,
87
-
88
- pointToString,
89
- pointsToString
90
- }
@@ -1,8 +1,8 @@
1
- const { pointsToString } = require('./translateHelpers')
1
+ import { pointsToString } from './translateHelpers.js'
2
2
 
3
- const { convertLine } = require('./instantiateLine')
3
+ import { convertLine } from './instantiateLine.js'
4
4
 
5
- const translateLine = (options, objects) => {
5
+ export const translateLine = (options, objects) => {
6
6
  const components = convertLine(options, objects)
7
7
  if (components) {
8
8
  const { pointsSet, colors } = components
@@ -24,5 +24,3 @@ const translateLine = (options, objects) => {
24
24
  }
25
25
  return null
26
26
  }
27
-
28
- module.exports = translateLine
@@ -1,10 +1,10 @@
1
- const { pointsToString } = require('./translateHelpers')
1
+ import { pointsToString } from './translateHelpers.js'
2
2
 
3
- const { convertMesh } = require('./instantiateMesh')
3
+ import { convertMesh } from './instantiateMesh.js'
4
4
 
5
5
  const translateToPolyhedron = (type, points, faces, colors, orientation) => {
6
6
  const colorsCode = Array.isArray(colors) ? pointsToString(colors) : 'null'
7
- const primitive = 'primitives.polyhedron({points, faces, colors, orientation})'
7
+ const primitive = 'polyhedron({points, faces, colors, orientation})'
8
8
  const code = `
9
9
  // 3D ${type} set: ${points.length} points, ${faces.length} faces
10
10
  const points = ${pointsToString(points)}
@@ -19,7 +19,7 @@ const translateToPolyhedron = (type, points, faces, colors, orientation) => {
19
19
  * Translate the given objects into mesh (polyhedron).
20
20
  * @return { primitive, code }
21
21
  */
22
- const translateMesh = (options, objects) => {
22
+ export const translateMesh = (options, objects) => {
23
23
  const components = convertMesh(options, objects)
24
24
  if (components) {
25
25
  const { type, points, faces, colors, orientation } = components
@@ -27,5 +27,3 @@ const translateMesh = (options, objects) => {
27
27
  }
28
28
  return null
29
29
  }
30
-
31
- module.exports = translateMesh