@bitbybit-dev/manifold 0.19.0-alpha.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/inputs/manifold-inputs.d.ts +17 -0
- package/lib/api/inputs/manifold-inputs.js +24 -0
- package/lib/api/services/manifold/manifold-booleans.d.ts +1 -0
- package/lib/api/services/manifold/manifold-booleans.js +29 -0
- 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
|
@@ -1063,6 +1063,23 @@ export declare namespace Manifold {
|
|
|
1063
1063
|
*/
|
|
1064
1064
|
originOffset: number;
|
|
1065
1065
|
}
|
|
1066
|
+
class SplitByPlaneOnOffsetsDto<T> {
|
|
1067
|
+
constructor(manifold?: T, normal?: Base.Vector3, originOffsets?: number[]);
|
|
1068
|
+
/**
|
|
1069
|
+
* Manifold that will be split
|
|
1070
|
+
*/
|
|
1071
|
+
manifold: T;
|
|
1072
|
+
/**
|
|
1073
|
+
* The normal vector of the plane to be mirrored over
|
|
1074
|
+
* @default [1,0,0]
|
|
1075
|
+
*/
|
|
1076
|
+
normal: Base.Vector3;
|
|
1077
|
+
/**
|
|
1078
|
+
* The offsets from the origin
|
|
1079
|
+
* @default [0]
|
|
1080
|
+
*/
|
|
1081
|
+
originOffsets: number[];
|
|
1082
|
+
}
|
|
1066
1083
|
class ManifoldsDto<T> {
|
|
1067
1084
|
constructor(manifolds?: T[]);
|
|
1068
1085
|
/**
|
|
@@ -1199,6 +1199,30 @@ export var Manifold;
|
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
Manifold.SplitByPlaneDto = SplitByPlaneDto;
|
|
1202
|
+
class SplitByPlaneOnOffsetsDto {
|
|
1203
|
+
constructor(manifold, normal, originOffsets) {
|
|
1204
|
+
/**
|
|
1205
|
+
* The normal vector of the plane to be mirrored over
|
|
1206
|
+
* @default [1,0,0]
|
|
1207
|
+
*/
|
|
1208
|
+
this.normal = [1, 0, 0];
|
|
1209
|
+
/**
|
|
1210
|
+
* The offsets from the origin
|
|
1211
|
+
* @default [0]
|
|
1212
|
+
*/
|
|
1213
|
+
this.originOffsets = [0];
|
|
1214
|
+
if (manifold !== undefined) {
|
|
1215
|
+
this.manifold = manifold;
|
|
1216
|
+
}
|
|
1217
|
+
if (normal !== undefined) {
|
|
1218
|
+
this.normal = normal;
|
|
1219
|
+
}
|
|
1220
|
+
if (originOffsets !== undefined) {
|
|
1221
|
+
this.originOffsets = originOffsets;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
Manifold.SplitByPlaneOnOffsetsDto = SplitByPlaneOnOffsetsDto;
|
|
1202
1226
|
class ManifoldsDto {
|
|
1203
1227
|
constructor(manifolds) {
|
|
1204
1228
|
if (manifolds !== undefined) {
|
|
@@ -5,6 +5,7 @@ export declare class ManifoldBooleans {
|
|
|
5
5
|
constructor(wasm: Manifold3D.ManifoldToplevel);
|
|
6
6
|
split(inputs: Inputs.Manifold.SplitManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
7
7
|
splitByPlane(inputs: Inputs.Manifold.SplitByPlaneDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
8
|
+
splitByPlaneOnOffsets(inputs: Inputs.Manifold.SplitByPlaneOnOffsetsDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
8
9
|
trimByPlane(inputs: Inputs.Manifold.TrimByPlaneDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
9
10
|
subtract(inputs: Inputs.Manifold.TwoManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
10
11
|
add(inputs: Inputs.Manifold.TwoManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
@@ -8,6 +8,35 @@ export class ManifoldBooleans {
|
|
|
8
8
|
splitByPlane(inputs) {
|
|
9
9
|
return inputs.manifold.splitByPlane(inputs.normal, inputs.originOffset);
|
|
10
10
|
}
|
|
11
|
+
splitByPlaneOnOffsets(inputs) {
|
|
12
|
+
const pieces = [];
|
|
13
|
+
const clone = inputs.manifold.asOriginal();
|
|
14
|
+
const remainders = [clone];
|
|
15
|
+
const junk = [];
|
|
16
|
+
inputs.originOffsets.forEach((s, i) => {
|
|
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
|
+
}
|
|
35
|
+
});
|
|
36
|
+
remainders.forEach(r => r.delete());
|
|
37
|
+
junk.forEach(j => j.delete());
|
|
38
|
+
return pieces;
|
|
39
|
+
}
|
|
11
40
|
trimByPlane(inputs) {
|
|
12
41
|
return inputs.manifold.asOriginal().trimByPlane(inputs.normal, inputs.originOffset);
|
|
13
42
|
}
|
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": {
|