@jscad/vtree 2.0.13 → 2.0.16

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 (48) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +2 -2
  3. package/core/api-measurements.js +8 -12
  4. package/core/buildCachedGeometryFromTree.js +2 -4
  5. package/core/cacheWithInvalidation.js +2 -2
  6. package/core/findDisconnectedSubGraphs.js +3 -3
  7. package/core/generators/geometry-generator-cached-csg.js +11 -13
  8. package/core/geometry-generator-cached.js +17 -19
  9. package/core/index.js +5 -5
  10. package/core/modeling/index-old.js +2 -2
  11. package/core/modeling/operations/measurements/measureArea.js +2 -2
  12. package/core/modeling/operations/measurements/measureBounds.js +2 -2
  13. package/core/modeling/operations/measurements/measureVolume.js +2 -2
  14. package/core/modeling/primitives/arc.js +1 -1
  15. package/core/modeling/primitives/cuboid.js +2 -2
  16. package/core/modeling/primitives/cylinderElliptic.js +2 -2
  17. package/core/modeling/primitives/line.js +1 -1
  18. package/core/modeling/primitives/rectangle.js +1 -1
  19. package/core/objectUtils.js +3 -5
  20. package/package.json +6 -6
  21. package/prototyping/examples/basic-base.js +1 -3
  22. package/prototyping/examples/basic-vtree.js +2 -4
  23. package/prototyping/examples/caching-shape-measurements.js +3 -3
  24. package/prototyping/examples/caching-test-vanilla-changed.js +18 -21
  25. package/prototyping/examples/caching-test-vanilla-changed2.js +16 -19
  26. package/prototyping/examples/caching-test-vanilla.js +15 -19
  27. package/prototyping/examples/caching-test-vtree-changed.js +18 -21
  28. package/prototyping/examples/caching-test-vtree-changed2.js +16 -19
  29. package/prototyping/examples/caching-test-vtree.js +15 -19
  30. package/prototyping/examples/caching-test.js +8 -10
  31. package/prototyping/examples/complex-base.js +19 -26
  32. package/prototyping/examples/complex-vtree-changed.js +19 -26
  33. package/prototyping/examples/complex-vtree.js +18 -25
  34. package/prototyping/examples/logo-base.js +9 -11
  35. package/prototyping/examples/logo-vtree.js +9 -11
  36. package/prototyping/examples/shapes-array-base.js +1 -3
  37. package/prototyping/examples/shapes-array-nested-vtree.js +15 -13
  38. package/prototyping/examples/shapes-array-vtree.js +2 -4
  39. package/prototyping/examples/single-shape-vtree.js +1 -3
  40. package/prototyping/examples/transforms-vtree.js +6 -9
  41. package/prototyping/examples/union-base.js +1 -3
  42. package/prototyping/examples/union-vtree.js +1 -3
  43. package/prototyping/io/deserializeGeometryCache.js +1 -1
  44. package/prototyping/io/serializeGeometryCache.js +1 -1
  45. package/prototyping/runBenchmark.js +9 -9
  46. package/prototyping/runCompare.js +6 -6
  47. package/vtree-api.js +1 -1
  48. package/prototyping/io/convertToBlob.js +0 -13
@@ -2,14 +2,14 @@ const generate = require('../core/geometry-generator-cached')
2
2
  // const decache = require('decache')
3
3
  const { toArray } = require('@jscad/array-utils')
4
4
 
5
- function runCompare (basePath, runs = 10) {
5
+ const runCompare = (basePath, runs = 10) => {
6
6
  console.log('running benchmarks for ' + basePath)
7
7
 
8
8
  const moduleNameVanilla = basePath + '-base'
9
9
  const moduleNameVtree = basePath + '-vtree'
10
10
  // first verify they all have the same output
11
11
  const baseLinePolyCounts = runVanilla(moduleNameVanilla)
12
- if (!samePolygonCount(baseLinePolyCounts, runVTreeTree(moduleNameVtree))) {
12
+ if (!samePolygonCount(baseLinePolyCounts, runVTree(moduleNameVtree))) {
13
13
  throw new Error(`Mismatch of polygon count in vtree-tree mode!! should be ${baseLinePolyCounts}`)
14
14
  }
15
15
  if (!samePolygonCount(baseLinePolyCounts, runVTree(moduleNameVtree))) {
@@ -27,7 +27,7 @@ const runPass = (moduleName, runFn, runs, name) => {
27
27
  let start
28
28
 
29
29
  const numbers = []
30
- for (var i = 0; i < runs; i++) {
30
+ for (let i = 0; i < runs; i++) {
31
31
  // decache(moduleName)
32
32
 
33
33
  start = process.hrtime()
@@ -43,17 +43,17 @@ const runPass = (moduleName, runFn, runs, name) => {
43
43
 
44
44
  const runVanilla = (moduleName) => {
45
45
  const results = toArray(require(moduleName)())
46
- const resultPolys = results.map(r => r.polygons.length)
46
+ const resultPolys = results.map((r) => r.polygons.length)
47
47
  return resultPolys
48
48
  }
49
49
  const runVTree = (moduleName) => {
50
50
  let results = require(moduleName)()
51
51
  results = toArray(generate(results))
52
- const resultPolys = results.map(r => r.polygons.length)
52
+ const resultPolys = results.map((r) => r.polygons.length)
53
53
  return resultPolys
54
54
  }
55
55
 
56
- const median = sequence => {
56
+ const median = (sequence) => {
57
57
  sequence.sort() // note that direction doesn't matter
58
58
  return sequence[Math.ceil(sequence.length / 2)]
59
59
  }
package/vtree-api.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./core/index/').apiClone
1
+ module.exports = require('./core/index').apiClone
@@ -1,13 +0,0 @@
1
- const { makeBlob } = require('@jscad/io-utils')
2
-
3
- const Blob = makeBlob()
4
-
5
- function convertToBlob (input) {
6
- const { data, mimeType } = input
7
- const blob = new Blob(data, { type: mimeType })
8
- return blob
9
- }
10
-
11
- module.exports = {
12
- convertToBlob
13
- }