@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.
- package/CHANGELOG.md +24 -0
- package/README.md +2 -2
- package/core/api-measurements.js +8 -12
- package/core/buildCachedGeometryFromTree.js +2 -4
- package/core/cacheWithInvalidation.js +2 -2
- package/core/findDisconnectedSubGraphs.js +3 -3
- package/core/generators/geometry-generator-cached-csg.js +11 -13
- package/core/geometry-generator-cached.js +17 -19
- package/core/index.js +5 -5
- package/core/modeling/index-old.js +2 -2
- package/core/modeling/operations/measurements/measureArea.js +2 -2
- package/core/modeling/operations/measurements/measureBounds.js +2 -2
- package/core/modeling/operations/measurements/measureVolume.js +2 -2
- package/core/modeling/primitives/arc.js +1 -1
- package/core/modeling/primitives/cuboid.js +2 -2
- package/core/modeling/primitives/cylinderElliptic.js +2 -2
- package/core/modeling/primitives/line.js +1 -1
- package/core/modeling/primitives/rectangle.js +1 -1
- package/core/objectUtils.js +3 -5
- package/package.json +6 -6
- package/prototyping/examples/basic-base.js +1 -3
- package/prototyping/examples/basic-vtree.js +2 -4
- package/prototyping/examples/caching-shape-measurements.js +3 -3
- package/prototyping/examples/caching-test-vanilla-changed.js +18 -21
- package/prototyping/examples/caching-test-vanilla-changed2.js +16 -19
- package/prototyping/examples/caching-test-vanilla.js +15 -19
- package/prototyping/examples/caching-test-vtree-changed.js +18 -21
- package/prototyping/examples/caching-test-vtree-changed2.js +16 -19
- package/prototyping/examples/caching-test-vtree.js +15 -19
- package/prototyping/examples/caching-test.js +8 -10
- package/prototyping/examples/complex-base.js +19 -26
- package/prototyping/examples/complex-vtree-changed.js +19 -26
- package/prototyping/examples/complex-vtree.js +18 -25
- package/prototyping/examples/logo-base.js +9 -11
- package/prototyping/examples/logo-vtree.js +9 -11
- package/prototyping/examples/shapes-array-base.js +1 -3
- package/prototyping/examples/shapes-array-nested-vtree.js +15 -13
- package/prototyping/examples/shapes-array-vtree.js +2 -4
- package/prototyping/examples/single-shape-vtree.js +1 -3
- package/prototyping/examples/transforms-vtree.js +6 -9
- package/prototyping/examples/union-base.js +1 -3
- package/prototyping/examples/union-vtree.js +1 -3
- package/prototyping/io/deserializeGeometryCache.js +1 -1
- package/prototyping/io/serializeGeometryCache.js +1 -1
- package/prototyping/runBenchmark.js +9 -9
- package/prototyping/runCompare.js +6 -6
- package/vtree-api.js +1 -1
- 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
|
-
|
|
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,
|
|
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 (
|
|
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
|
|
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
|
-
}
|