@bitbybit-dev/manifold 0.19.0 → 0.19.1
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/README.md +14 -13
- package/babel.config.cjs +6 -3
- package/babel.config.d.cts +1 -0
- package/lib/api/services/manifold/manifold-booleans.js +20 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<img src="https://app.bitbybit.dev/assets/git-cover.png" alt="Picture showing bitbybit.dev platform">
|
|
4
4
|
|
|
5
|
-
This project exposes 3D algorithms based on manifold-3d 3D CAD kernel, developed by Emmett Lalish, which you can find on https://github.com/elalish/manifold. Bit By Bit Developers platform integrates this kernel into it's platform via this library. Currently we try to expose Manifold library 1:1 in terms of functionality through our structured API, but as time goes we will have more unique algorithms in this package, which will be tuned specifically to our users.
|
|
5
|
+
This project exposes 3D algorithms based on manifold-3d 3D CAD kernel, developed by Emmett Lalish and Chun Kit LAM, which you can find on https://github.com/elalish/manifold. Bit By Bit Developers platform integrates this kernel into it's platform via this library. Currently we try to expose Manifold library 1:1 in terms of functionality through our structured API, but as time goes we will have more unique algorithms in this package, which will be tuned specifically to our users.
|
|
6
6
|
|
|
7
7
|
This package should work in Node and browser based applications. If you want to use this package in your browser based applications we highly suggest to use @bitbybit-dev/manifold-webworker npm package, which wraps this lib into promisified non-blocking API.
|
|
8
8
|
|
|
@@ -13,23 +13,24 @@ https://github.com/bitbybit-dev/bitbybit/tree/master/packages/dev/manifold
|
|
|
13
13
|
## NPM
|
|
14
14
|
https://www.npmjs.com/package/@bitbybit-dev/manifold
|
|
15
15
|
|
|
16
|
-
## THREEJS Example Applications
|
|
17
|
-
|
|
18
|
-
https://
|
|
19
|
-
|
|
16
|
+
## THREEJS Example Applications Using Manifold
|
|
17
|
+
[Manifold Sliced Mesh](https://app-store.bitbybit.dev/manifold-sliced-mesh/)
|
|
18
|
+
[Github Source Code](https://github.com/bitbybit-dev/app-examples/blob/main/webpack/threejs/src/code/manifold-sliced-mesh.ts)
|
|
19
|
+
|
|
20
|
+
## Other THREEJS Applications
|
|
21
|
+
[Vase](https://app-store.bitbybit.dev/vase)
|
|
22
|
+
[Github source code](https://github.com/bitbybit-dev/app-examples/tree/main/react/threejs/vase)
|
|
20
23
|
|
|
21
24
|
## Other Example Applications
|
|
22
|
-
Laptop Holder
|
|
23
|
-
https://
|
|
24
|
-
Github Source Code
|
|
25
|
-
Github Source Code React - https://github.com/bitbybit-dev/app-examples/tree/main/react/laptop-holder
|
|
25
|
+
[Laptop Holder](https://app-store.bitbybit.dev/laptop-holder)
|
|
26
|
+
[Github Source Code Angular](https://github.com/bitbybit-dev/app-examples/tree/main/angular/laptop-holder)
|
|
27
|
+
[Github Source Code React](https://github.com/bitbybit-dev/app-examples/tree/main/react/laptop-holder)
|
|
26
28
|
|
|
27
|
-
Cup Configurator
|
|
28
|
-
https://
|
|
29
|
-
Github Source Code - https://github.com/bitbybit-dev/app-examples/tree/main/react/cup
|
|
29
|
+
[Cup Configurator](https://app-store.bitbybit.dev/cup)
|
|
30
|
+
[Github Source Code](https://github.com/bitbybit-dev/app-examples/tree/main/react/cup)
|
|
30
31
|
|
|
31
32
|
## Closed Source Example Applications
|
|
32
|
-
https://app-store.bitbybit.dev/terrace-furniture
|
|
33
|
+
[Terrace Furniture](https://app-store.bitbybit.dev/terrace-furniture)
|
|
33
34
|
|
|
34
35
|
## Build package
|
|
35
36
|
npm run build-p
|
package/babel.config.cjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
presets: [
|
|
3
3
|
[
|
|
4
|
-
|
|
4
|
+
"@babel/preset-env",
|
|
5
5
|
{
|
|
6
6
|
targets: {
|
|
7
|
-
node:
|
|
7
|
+
node: "current",
|
|
8
8
|
},
|
|
9
9
|
},
|
|
10
10
|
],
|
|
11
|
-
|
|
11
|
+
"@babel/preset-typescript"
|
|
12
|
+
],
|
|
13
|
+
plugins: [
|
|
14
|
+
"babel-plugin-transform-import-meta"
|
|
12
15
|
],
|
|
13
16
|
};
|
|
14
17
|
export {};
|
package/babel.config.d.cts
CHANGED
|
@@ -12,14 +12,29 @@ export class ManifoldBooleans {
|
|
|
12
12
|
const pieces = [];
|
|
13
13
|
const clone = inputs.manifold.asOriginal();
|
|
14
14
|
const remainders = [clone];
|
|
15
|
-
|
|
15
|
+
const junk = [];
|
|
16
16
|
inputs.originOffsets.forEach((s, i) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
if (remainders[i]) {
|
|
18
|
+
const halfs = remainders[i].splitByPlane(inputs.normal, s);
|
|
19
|
+
if (!halfs[1].isEmpty() && !halfs[0].isEmpty()) {
|
|
20
|
+
pieces.push(halfs[1]);
|
|
21
|
+
remainders.push(halfs[0]);
|
|
22
|
+
}
|
|
23
|
+
else if (halfs[1].isEmpty() && !halfs[0].isEmpty()) {
|
|
24
|
+
remainders.push(halfs[0]);
|
|
25
|
+
junk.push(halfs[1]);
|
|
26
|
+
}
|
|
27
|
+
else if (!halfs[1].isEmpty() && halfs[0].isEmpty()) {
|
|
28
|
+
pieces.push(halfs[1]);
|
|
29
|
+
junk.push(halfs[0]);
|
|
30
|
+
}
|
|
31
|
+
else if (halfs[0].isEmpty() && halfs[1].isEmpty()) {
|
|
32
|
+
junk.push(...halfs);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
20
35
|
});
|
|
21
|
-
// release remainders
|
|
22
36
|
remainders.forEach(r => r.delete());
|
|
37
|
+
junk.forEach(j => j.delete());
|
|
23
38
|
return pieces;
|
|
24
39
|
}
|
|
25
40
|
trimByPlane(inputs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbybit-dev/manifold",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Bit By Bit Developers Manifold based CAD Library to Program Geometry",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"build-p": "npm run build && npm run copy-package && npm run copy-readme && npm run delete-coverage",
|
|
49
49
|
"copy-package": "cp -R ./package.json ./dist",
|
|
50
50
|
"copy-readme": "cp -R ./README.md ./dist && cp -R ./LICENSE ./dist",
|
|
51
|
-
"delete-coverage": "rm -
|
|
51
|
+
"delete-coverage": "rm -rf ./dist/coverage || true",
|
|
52
52
|
"test": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --watchAll=true",
|
|
53
53
|
"test-c": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=false",
|
|
54
54
|
"test-c-l": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=true"
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"ts-jest": "29.0.0",
|
|
70
70
|
"typescript": "4.8.2",
|
|
71
71
|
"@types/jest": "29.0.0",
|
|
72
|
-
"@types/three": "0.169.0",
|
|
73
72
|
"babel-jest": "29.0.0",
|
|
74
73
|
"@babel/core": "7.16.0",
|
|
75
74
|
"@babel/preset-env": "7.16.0",
|
|
76
75
|
"@babel/preset-typescript": "7.16.0",
|
|
76
|
+
"babel-plugin-transform-import-meta": "2.2.1",
|
|
77
77
|
"jest-html-reporters": "3.0.11"
|
|
78
78
|
},
|
|
79
79
|
"jest": {
|