@bitbybit-dev/manifold 1.1.1 → 1.2.0-rc.0
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 -4
- package/index.js +0 -3
- package/lib/api/inputs/base-inputs.js +0 -1
- package/lib/api/inputs/manifold-inputs.d.ts +63 -23
- package/lib/api/inputs/manifold-inputs.js +114 -1
- package/lib/api/manifold-service.d.ts +30 -2
- package/lib/api/manifold-service.js +43 -22
- package/lib/api/services/cross-section/cross-section-booleans.d.ts +78 -2
- package/lib/api/services/cross-section/cross-section-booleans.js +86 -10
- package/lib/api/services/cross-section/cross-section-evaluate.d.ts +45 -2
- package/lib/api/services/cross-section/cross-section-evaluate.js +45 -2
- package/lib/api/services/cross-section/cross-section-operations.d.ts +71 -0
- package/lib/api/services/cross-section/cross-section-operations.js +71 -2
- package/lib/api/services/cross-section/cross-section-shapes.d.ts +39 -0
- package/lib/api/services/cross-section/cross-section-shapes.js +39 -0
- package/lib/api/services/cross-section/cross-section-transforms.d.ts +72 -2
- package/lib/api/services/cross-section/cross-section-transforms.js +72 -2
- package/lib/api/services/cross-section/cross-section.d.ts +53 -1
- package/lib/api/services/cross-section/cross-section.js +53 -5
- package/lib/api/services/index.js +1 -0
- package/lib/api/services/manifold/manifold-booleans.d.ts +116 -6
- package/lib/api/services/manifold/manifold-booleans.js +159 -48
- package/lib/api/services/manifold/manifold-evaluate.d.ts +133 -3
- package/lib/api/services/manifold/manifold-evaluate.js +135 -5
- package/lib/api/services/manifold/manifold-operations.d.ts +202 -1
- package/lib/api/services/manifold/manifold-operations.js +204 -3
- package/lib/api/services/manifold/manifold-shapes.d.ts +59 -0
- package/lib/api/services/manifold/manifold-shapes.js +78 -20
- package/lib/api/services/manifold/manifold-transforms.d.ts +97 -3
- package/lib/api/services/manifold/manifold-transforms.js +102 -6
- package/lib/api/services/manifold/manifold.d.ts +20 -0
- package/lib/api/services/manifold/manifold.js +20 -1
- package/lib/api/services/mesh/mesh-evaluate.d.ts +81 -3
- package/lib/api/services/mesh/mesh-evaluate.js +84 -6
- package/lib/api/services/mesh/mesh-operations.d.ts +24 -2
- package/lib/api/services/mesh/mesh-operations.js +24 -2
- package/lib/api/services/mesh/mesh.d.ts +4 -0
- package/lib/api/services/mesh/mesh.js +4 -1
- package/package.json +6 -45
- package/babel.config.cjs +0 -17
- package/babel.config.d.cts +0 -6
|
@@ -1,36 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
3
|
+
* Thanks Manifold community for developing this kernel
|
|
4
|
+
*/
|
|
1
5
|
export class MeshEvaluate {
|
|
2
|
-
constructor(
|
|
3
|
-
this.manifold = wasm;
|
|
6
|
+
constructor(_wasm) {
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Get position on mesh vertex index
|
|
10
|
+
* @param inputs mesh
|
|
11
|
+
* @returns point
|
|
12
|
+
* @group basic
|
|
13
|
+
* @shortname position
|
|
14
|
+
* @drawable true
|
|
15
|
+
*/
|
|
5
16
|
position(inputs) {
|
|
6
17
|
const res = inputs.mesh.position(inputs.vertexIndex);
|
|
7
18
|
return [res[0], res[1], res[2]];
|
|
8
19
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Gets the three vertex indices of this triangle in CCW order.
|
|
22
|
+
* @param inputs mesh
|
|
23
|
+
* @returns verts
|
|
24
|
+
* @group basic
|
|
25
|
+
* @shortname verts
|
|
26
|
+
* @drawable false
|
|
27
|
+
*/
|
|
13
28
|
verts(inputs) {
|
|
14
29
|
const res = inputs.mesh.verts(inputs.triangleIndex);
|
|
15
30
|
return [res[0], res[1], res[2]];
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the tangent vector starting at verts(tri)[j] pointing to the next
|
|
34
|
+
* Bezier point along the CCW edge. The fourth value is its weight.
|
|
35
|
+
* @param inputs mesh
|
|
36
|
+
* @returns tangent
|
|
37
|
+
* @group basic
|
|
38
|
+
* @shortname tangent
|
|
39
|
+
* @drawable true
|
|
40
|
+
*/
|
|
41
|
+
tangent(inputs) {
|
|
42
|
+
const res = inputs.mesh.tangent(inputs.halfEdgeIndex);
|
|
43
|
+
return [res[0], res[1], res[2], res[4]];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets any other properties associated with this vertex.
|
|
47
|
+
* @param inputs mesh
|
|
48
|
+
* @returns extras
|
|
49
|
+
* @group basic
|
|
50
|
+
* @shortname extras
|
|
51
|
+
* @drawable false
|
|
52
|
+
*/
|
|
17
53
|
extras(inputs) {
|
|
18
54
|
const res = inputs.mesh.extras(inputs.vertexIndex);
|
|
19
55
|
return [...res];
|
|
20
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the column-major 4x4 matrix transform from the original mesh to these
|
|
59
|
+
* related triangles.
|
|
60
|
+
* @param inputs mesh
|
|
61
|
+
* @returns transform matrix
|
|
62
|
+
* @group basic
|
|
63
|
+
* @shortname transform 4x4 matrix
|
|
64
|
+
* @drawable false
|
|
65
|
+
*/
|
|
21
66
|
transform(inputs) {
|
|
22
67
|
const res = inputs.mesh.transform(inputs.triangleRunIndex);
|
|
23
68
|
return [...res];
|
|
24
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Number of properties per vertex, always >= 3.
|
|
72
|
+
* @param inputs mesh
|
|
73
|
+
* @returns number of properties
|
|
74
|
+
* @group basic
|
|
75
|
+
* @shortname number props
|
|
76
|
+
* @drawable false
|
|
77
|
+
*/
|
|
25
78
|
numProp(inputs) {
|
|
26
79
|
return inputs.mesh.numProp;
|
|
27
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Number of property vertices
|
|
83
|
+
* @param inputs mesh
|
|
84
|
+
* @returns number of vertices
|
|
85
|
+
* @group basic
|
|
86
|
+
* @shortname number vertices
|
|
87
|
+
* @drawable false
|
|
88
|
+
*/
|
|
28
89
|
numVert(inputs) {
|
|
29
90
|
return inputs.mesh.numVert;
|
|
30
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Get number of triangles on mesh
|
|
94
|
+
* @param inputs mesh
|
|
95
|
+
* @returns number of triangles
|
|
96
|
+
* @group basic
|
|
97
|
+
* @shortname number triangles
|
|
98
|
+
* @drawable false
|
|
99
|
+
*/
|
|
31
100
|
numTri(inputs) {
|
|
32
101
|
return inputs.mesh.numTri;
|
|
33
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Number of triangle runs. Each triangle run is a set of consecutive
|
|
105
|
+
* triangles that all come from the same instance of the same input mesh.
|
|
106
|
+
* @param inputs mesh
|
|
107
|
+
* @returns number of runs
|
|
108
|
+
* @group basic
|
|
109
|
+
* @shortname number runs
|
|
110
|
+
* @drawable false
|
|
111
|
+
*/
|
|
34
112
|
numRun(inputs) {
|
|
35
113
|
return inputs.mesh.numRun;
|
|
36
114
|
}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import * as Inputs from "../../inputs";
|
|
2
2
|
import * as Manifold3D from "manifold-3d";
|
|
3
|
+
/**
|
|
4
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
5
|
+
* Thanks Manifold community for developing this kernel
|
|
6
|
+
*/
|
|
3
7
|
export declare class MeshOperations {
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
constructor(_wasm: Manifold3D.ManifoldToplevel);
|
|
9
|
+
/**
|
|
10
|
+
* Updates the mergeFromVert and mergeToVert vectors in order to create a
|
|
11
|
+
* manifold solid. If the MeshGL is already manifold, no change will occur and
|
|
12
|
+
* the function will return false. Otherwise, this will merge verts along open
|
|
13
|
+
* edges within tolerance (the maximum of the MeshGL tolerance and the
|
|
14
|
+
* baseline bounding-box tolerance), keeping any from the existing merge
|
|
15
|
+
* vectors.
|
|
16
|
+
*
|
|
17
|
+
* There is no guarantee the result will be manifold - this is a best-effort
|
|
18
|
+
* helper function designed primarily to aid in the case where a manifold
|
|
19
|
+
* multi-material MeshGL was produced, but its merge vectors were lost due to
|
|
20
|
+
* a round-trip through a file format. Constructing a Manifold from the result
|
|
21
|
+
* will report a Status if it is not manifold.
|
|
22
|
+
* @param inputs mesh
|
|
23
|
+
* @returns merged mesh
|
|
24
|
+
* @group base
|
|
25
|
+
* @shortname merge
|
|
26
|
+
* @drawable true
|
|
27
|
+
*/
|
|
6
28
|
merge(inputs: Inputs.Manifold.MeshDto<Manifold3D.Mesh>): boolean;
|
|
7
29
|
}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
3
|
+
* Thanks Manifold community for developing this kernel
|
|
4
|
+
*/
|
|
1
5
|
export class MeshOperations {
|
|
2
|
-
constructor(
|
|
3
|
-
this.manifold = wasm;
|
|
6
|
+
constructor(_wasm) {
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Updates the mergeFromVert and mergeToVert vectors in order to create a
|
|
10
|
+
* manifold solid. If the MeshGL is already manifold, no change will occur and
|
|
11
|
+
* the function will return false. Otherwise, this will merge verts along open
|
|
12
|
+
* edges within tolerance (the maximum of the MeshGL tolerance and the
|
|
13
|
+
* baseline bounding-box tolerance), keeping any from the existing merge
|
|
14
|
+
* vectors.
|
|
15
|
+
*
|
|
16
|
+
* There is no guarantee the result will be manifold - this is a best-effort
|
|
17
|
+
* helper function designed primarily to aid in the case where a manifold
|
|
18
|
+
* multi-material MeshGL was produced, but its merge vectors were lost due to
|
|
19
|
+
* a round-trip through a file format. Constructing a Manifold from the result
|
|
20
|
+
* will report a Status if it is not manifold.
|
|
21
|
+
* @param inputs mesh
|
|
22
|
+
* @returns merged mesh
|
|
23
|
+
* @group base
|
|
24
|
+
* @shortname merge
|
|
25
|
+
* @drawable true
|
|
26
|
+
*/
|
|
5
27
|
merge(inputs) {
|
|
6
28
|
return inputs.mesh.merge();
|
|
7
29
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as Manifold3D from "manifold-3d";
|
|
2
2
|
import { MeshEvaluate } from "./mesh-evaluate";
|
|
3
3
|
import { MeshOperations } from "./mesh-operations";
|
|
4
|
+
/**
|
|
5
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
6
|
+
* Thanks Manifold community for developing this kernel
|
|
7
|
+
*/
|
|
4
8
|
export declare class Mesh {
|
|
5
9
|
plugins: any;
|
|
6
10
|
operations: MeshOperations;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { MeshEvaluate } from "./mesh-evaluate";
|
|
2
2
|
import { MeshOperations } from "./mesh-operations";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
5
|
+
* Thanks Manifold community for developing this kernel
|
|
6
|
+
*/
|
|
4
7
|
export class Mesh {
|
|
5
8
|
constructor(wasm) {
|
|
6
9
|
this.operations = new MeshOperations(wasm);
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbybit-dev/manifold",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-rc.0",
|
|
4
4
|
"description": "Bit By Bit Developers Manifold based CAD Library to Program Geometry",
|
|
5
|
+
"homepage": "https://docs.bitbybit.dev/classes/Bit.Manifold",
|
|
5
6
|
"main": "index.js",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/bitbybit-dev/bitbybit"
|
|
9
|
+
"url": "git+https://github.com/bitbybit-dev/bitbybit.git",
|
|
10
|
+
"directory": "packages/dev/manifold"
|
|
9
11
|
},
|
|
10
12
|
"keywords": [
|
|
11
13
|
"Bit By Bit Developers",
|
|
@@ -43,16 +45,6 @@
|
|
|
43
45
|
"directories": {
|
|
44
46
|
"lib": "lib"
|
|
45
47
|
},
|
|
46
|
-
"scripts": {
|
|
47
|
-
"build": "tsc -p tsconfig.bitbybit.json",
|
|
48
|
-
"build-p": "npm run build && npm run copy-package && npm run copy-readme && npm run delete-coverage",
|
|
49
|
-
"copy-package": "shx cp -R ./package.json ./dist",
|
|
50
|
-
"copy-readme": "shx cp -R ./README.md ./dist && shx cp -R ./LICENSE ./dist",
|
|
51
|
-
"delete-coverage": "shx rm -rf ./dist/coverage || true",
|
|
52
|
-
"test": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --watchAll=true",
|
|
53
|
-
"test-c": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=false",
|
|
54
|
-
"test-c-l": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=true"
|
|
55
|
-
},
|
|
56
48
|
"author": "Bit by bit developers",
|
|
57
49
|
"license": "MIT",
|
|
58
50
|
"funding": {
|
|
@@ -63,37 +55,6 @@
|
|
|
63
55
|
"type": "module",
|
|
64
56
|
"dependencies": {
|
|
65
57
|
"manifold-3d": "3.3.2",
|
|
66
|
-
"@bitbybit-dev/base": "1.
|
|
67
|
-
},
|
|
68
|
-
"devDependencies": {
|
|
69
|
-
"shx": "0.4.0",
|
|
70
|
-
"@testing-library/jest-dom": "6.9.1",
|
|
71
|
-
"mvdir": "1.0.22",
|
|
72
|
-
"jest": "30.4.2",
|
|
73
|
-
"ts-node": "10.9.2",
|
|
74
|
-
"ts-jest": "29.4.10",
|
|
75
|
-
"typescript": "5.9.3",
|
|
76
|
-
"@types/jest": "30.0.0",
|
|
77
|
-
"babel-jest": "30.4.1",
|
|
78
|
-
"@babel/core": "7.29.0",
|
|
79
|
-
"@babel/preset-env": "7.29.5",
|
|
80
|
-
"@babel/preset-typescript": "7.28.5",
|
|
81
|
-
"babel-plugin-transform-import-meta": "2.3.3",
|
|
82
|
-
"jest-html-reporters": "3.1.7"
|
|
83
|
-
},
|
|
84
|
-
"jest": {
|
|
85
|
-
"preset": "ts-jest",
|
|
86
|
-
"transform": {
|
|
87
|
-
"\\.[jt]sx?$": "babel-jest"
|
|
88
|
-
},
|
|
89
|
-
"extensionsToTreatAsEsm": [
|
|
90
|
-
".ts"
|
|
91
|
-
],
|
|
92
|
-
"transformIgnorePatterns": [
|
|
93
|
-
"node_modules/(?!@bitbybit-dev)/"
|
|
94
|
-
],
|
|
95
|
-
"collectCoverageFrom": [
|
|
96
|
-
"lib/api/**/*"
|
|
97
|
-
]
|
|
58
|
+
"@bitbybit-dev/base": "1.2.0-rc.0"
|
|
98
59
|
}
|
|
99
|
-
}
|
|
60
|
+
}
|
package/babel.config.cjs
DELETED