@bitbybit-dev/manifold 0.19.0 → 0.19.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Bit By Bit Developers
3
+ Copyright (c)2025 Bit By Bit Developers
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,35 +1,38 @@
1
1
  ## Bit By Bit Developers Manifold based CAD library
2
2
 
3
+ Visit [bitbybit.dev](https://bitbybit.dev) to use our full cloud platform.
4
+ Best way to support us - [Silver or Gold plan subscription](https://bitbybit.dev/auth/pick-plan)
5
+ Check out [3D Bits app for Shopify](https://apps.shopify.com/3d-bits-1)
6
+
3
7
  <img src="https://app.bitbybit.dev/assets/git-cover.png" alt="Picture showing bitbybit.dev platform">
4
8
 
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.
9
+ 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
10
 
7
11
  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
12
 
9
- Visit https://bitbybit.dev to use our full cloud platform.
10
-
11
13
  ## Github
12
14
  https://github.com/bitbybit-dev/bitbybit/tree/master/packages/dev/manifold
13
15
  ## NPM
14
16
  https://www.npmjs.com/package/@bitbybit-dev/manifold
15
17
 
16
- ## THREEJS Example Applications
17
- Vase
18
- https://app-store.bitbybit.dev/vase
19
- Github Source Code - https://github.com/bitbybit-dev/app-examples/tree/main/react/threejs/vase
18
+ ## THREEJS Example Applications Using Manifold
19
+ [Manifold Sliced Mesh](https://app-store.bitbybit.dev/manifold-sliced-mesh/)
20
+ [Github Source Code](https://github.com/bitbybit-dev/app-examples/blob/main/webpack/threejs/src/code/manifold-sliced-mesh.ts)
21
+
22
+ ## Other THREEJS Applications
23
+ [Vase](https://app-store.bitbybit.dev/vase)
24
+ [Github source code](https://github.com/bitbybit-dev/app-examples/tree/main/react/threejs/vase)
20
25
 
21
26
  ## Other Example Applications
22
- Laptop Holder
23
- https://app-store.bitbybit.dev/laptop-holder
24
- Github Source Code Angular - https://github.com/bitbybit-dev/app-examples/tree/main/angular/laptop-holder
25
- Github Source Code React - https://github.com/bitbybit-dev/app-examples/tree/main/react/laptop-holder
27
+ [Laptop Holder](https://app-store.bitbybit.dev/laptop-holder)
28
+ [Github Source Code Angular](https://github.com/bitbybit-dev/app-examples/tree/main/angular/laptop-holder)
29
+ [Github Source Code React](https://github.com/bitbybit-dev/app-examples/tree/main/react/laptop-holder)
26
30
 
27
- Cup Configurator
28
- https://app-store.bitbybit.dev/cup
29
- Github Source Code - https://github.com/bitbybit-dev/app-examples/tree/main/react/cup
31
+ [Cup Configurator](https://app-store.bitbybit.dev/cup)
32
+ [Github Source Code](https://github.com/bitbybit-dev/app-examples/tree/main/react/cup)
30
33
 
31
34
  ## Closed Source Example Applications
32
- https://app-store.bitbybit.dev/terrace-furniture
35
+ [Terrace Furniture](https://app-store.bitbybit.dev/terrace-furniture)
33
36
 
34
37
  ## Build package
35
38
  npm run build-p
package/babel.config.cjs CHANGED
@@ -1,14 +1,17 @@
1
1
  module.exports = {
2
2
  presets: [
3
3
  [
4
- '@babel/preset-env',
4
+ "@babel/preset-env",
5
5
  {
6
6
  targets: {
7
- node: 'current',
7
+ node: "current",
8
8
  },
9
9
  },
10
10
  ],
11
- '@babel/preset-typescript'
11
+ "@babel/preset-typescript"
12
+ ],
13
+ plugins: [
14
+ "babel-plugin-transform-import-meta"
12
15
  ],
13
16
  };
14
17
  export {};
@@ -3,3 +3,4 @@ export const presets: (string | (string | {
3
3
  node: string;
4
4
  };
5
5
  })[])[];
6
+ export const plugins: string[];
@@ -12,14 +12,29 @@ export class ManifoldBooleans {
12
12
  const pieces = [];
13
13
  const clone = inputs.manifold.asOriginal();
14
14
  const remainders = [clone];
15
- // original should not be deleted
15
+ const junk = [];
16
16
  inputs.originOffsets.forEach((s, i) => {
17
- const halfs = remainders[i].splitByPlane(inputs.normal, s);
18
- pieces.push(halfs[1]);
19
- remainders.push(halfs[0]);
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.0",
3
+ "version": "0.19.2",
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 -R ./dist/coverage",
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": {