@bitbybit-dev/manifold 1.1.1 → 1.2.0-rc.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 -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,82 +1,193 @@
|
|
|
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 ManifoldBooleans {
|
|
2
6
|
constructor(wasm) {
|
|
3
7
|
this.manifold = wasm;
|
|
4
8
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
}
|
|
40
|
-
trimByPlane(inputs) {
|
|
41
|
-
return inputs.manifold.asOriginal().trimByPlane(inputs.normal, inputs.originOffset);
|
|
42
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* Subtract two manifold shapes
|
|
11
|
+
* @param inputs two shapes
|
|
12
|
+
* @returns subtracted manifold shape
|
|
13
|
+
* @group a to b
|
|
14
|
+
* @shortname subtract
|
|
15
|
+
* @drawable true
|
|
16
|
+
*/
|
|
43
17
|
subtract(inputs) {
|
|
44
18
|
return inputs.manifold1.subtract(inputs.manifold2);
|
|
45
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Add two manifold shapes
|
|
22
|
+
* @param inputs two shapes
|
|
23
|
+
* @returns unioned manifold shape
|
|
24
|
+
* @group a to b
|
|
25
|
+
* @shortname add
|
|
26
|
+
* @drawable true
|
|
27
|
+
*/
|
|
46
28
|
add(inputs) {
|
|
47
29
|
return inputs.manifold1.add(inputs.manifold2);
|
|
48
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Intersect two manifold shapes
|
|
33
|
+
* @param inputs two shapes
|
|
34
|
+
* @returns intersected manifold shape
|
|
35
|
+
* @group a to b
|
|
36
|
+
* @shortname intersect
|
|
37
|
+
* @drawable true
|
|
38
|
+
*/
|
|
49
39
|
intersect(inputs) {
|
|
50
40
|
return inputs.manifold1.intersect(inputs.manifold2);
|
|
51
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Difference of two manifold shapes
|
|
44
|
+
* @param inputs two shapes
|
|
45
|
+
* @returns difference of two manifold shapes
|
|
46
|
+
* @group 2 manifolds
|
|
47
|
+
* @shortname difference 2 manifolds
|
|
48
|
+
* @drawable true
|
|
49
|
+
*/
|
|
52
50
|
differenceTwo(inputs) {
|
|
53
51
|
const { Manifold } = this.manifold;
|
|
54
52
|
const { difference } = Manifold;
|
|
55
53
|
return difference(inputs.manifold1, inputs.manifold2);
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Union of two manifold shapes
|
|
57
|
+
* @param inputs two shapes
|
|
58
|
+
* @returns union of two manifold shapes
|
|
59
|
+
* @group 2 manifolds
|
|
60
|
+
* @shortname union 2 manifolds
|
|
61
|
+
* @drawable true
|
|
62
|
+
*/
|
|
62
63
|
unionTwo(inputs) {
|
|
63
64
|
const { Manifold } = this.manifold;
|
|
64
65
|
const { union } = Manifold;
|
|
65
66
|
return union(inputs.manifold1, inputs.manifold2);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Intersection of two manifold shapes
|
|
70
|
+
* @param inputs two shapes
|
|
71
|
+
* @returns intersection of two manifold shapes
|
|
72
|
+
* @group 2 manifolds
|
|
73
|
+
* @shortname intersection 2 manifolds
|
|
74
|
+
* @drawable true
|
|
75
|
+
*/
|
|
72
76
|
intersectionTwo(inputs) {
|
|
73
77
|
const { Manifold } = this.manifold;
|
|
74
78
|
const { intersection } = Manifold;
|
|
75
79
|
return intersection(inputs.manifold1, inputs.manifold2);
|
|
76
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Difference of multiple manifold shapes
|
|
83
|
+
* @param inputs multiple shapes
|
|
84
|
+
* @returns difference of two manifold shapes
|
|
85
|
+
* @group multiple
|
|
86
|
+
* @shortname difference manifolds
|
|
87
|
+
* @drawable true
|
|
88
|
+
*/
|
|
89
|
+
difference(inputs) {
|
|
90
|
+
const { Manifold } = this.manifold;
|
|
91
|
+
const { difference } = Manifold;
|
|
92
|
+
return difference(inputs.manifolds);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Union of multiple manifold shapes
|
|
96
|
+
* @param inputs multiple shapes
|
|
97
|
+
* @returns union of two manifold shapes
|
|
98
|
+
* @group multiple
|
|
99
|
+
* @shortname union manifolds
|
|
100
|
+
* @drawable true
|
|
101
|
+
*/
|
|
102
|
+
union(inputs) {
|
|
103
|
+
const { Manifold } = this.manifold;
|
|
104
|
+
const { union } = Manifold;
|
|
105
|
+
return union(inputs.manifolds);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Intersection of multiple manifold shapes
|
|
109
|
+
* @param inputs two shapes
|
|
110
|
+
* @returns intersection of multiple manifold shapes
|
|
111
|
+
* @group multiple
|
|
112
|
+
* @shortname intersection manifolds
|
|
113
|
+
* @drawable true
|
|
114
|
+
*/
|
|
77
115
|
intersection(inputs) {
|
|
78
116
|
const { Manifold } = this.manifold;
|
|
79
117
|
const { intersection } = Manifold;
|
|
80
118
|
return intersection(inputs.manifolds);
|
|
81
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Split manifold by another manifold
|
|
122
|
+
* @param inputs manifold to split and manifold cutter
|
|
123
|
+
* @returns split manifold
|
|
124
|
+
* @group split
|
|
125
|
+
* @shortname split
|
|
126
|
+
* @drawable true
|
|
127
|
+
*/
|
|
128
|
+
split(inputs) {
|
|
129
|
+
return inputs.manifoldToSplit.split(inputs.manifoldCutter);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Split manifold by plane
|
|
133
|
+
* @param inputs manifold and plane
|
|
134
|
+
* @returns split manifold
|
|
135
|
+
* @group split
|
|
136
|
+
* @shortname split by plane
|
|
137
|
+
* @drawable true
|
|
138
|
+
*/
|
|
139
|
+
splitByPlane(inputs) {
|
|
140
|
+
return inputs.manifold.splitByPlane(inputs.normal, inputs.originOffset);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Split manifold by plane on various offsets. Each cut takes the part below the plane as a
|
|
144
|
+
* finished piece and carries the part above it to the next, larger offset, so a run of n offsets
|
|
145
|
+
* yields n + 1 pieces and accounts for the whole of the solid.
|
|
146
|
+
* @param inputs manifold, plane and the list of offsets
|
|
147
|
+
* @returns splitted manifolds, one more than the offsets given
|
|
148
|
+
* @group split
|
|
149
|
+
* @shortname split by plane on offsets
|
|
150
|
+
* @drawable true
|
|
151
|
+
*/
|
|
152
|
+
splitByPlaneOnOffsets(inputs) {
|
|
153
|
+
const pieces = [];
|
|
154
|
+
const junk = [];
|
|
155
|
+
let remainder = inputs.manifold.asOriginal();
|
|
156
|
+
inputs.originOffsets.forEach((offset) => {
|
|
157
|
+
if (!remainder) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const halfs = remainder.splitByPlane(inputs.normal, offset);
|
|
161
|
+
junk.push(remainder);
|
|
162
|
+
remainder = undefined;
|
|
163
|
+
if (halfs[1].isEmpty()) {
|
|
164
|
+
junk.push(halfs[1]);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
pieces.push(halfs[1]);
|
|
168
|
+
}
|
|
169
|
+
if (halfs[0].isEmpty()) {
|
|
170
|
+
junk.push(halfs[0]);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
remainder = halfs[0];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
if (remainder) {
|
|
177
|
+
pieces.push(remainder);
|
|
178
|
+
}
|
|
179
|
+
junk.forEach(j => j.delete());
|
|
180
|
+
return pieces;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Trim manifold by plane
|
|
184
|
+
* @param inputs manifold and plane
|
|
185
|
+
* @returns trimmed manifold
|
|
186
|
+
* @group trim
|
|
187
|
+
* @shortname trim by plane
|
|
188
|
+
* @drawable true
|
|
189
|
+
*/
|
|
190
|
+
trimByPlane(inputs) {
|
|
191
|
+
return inputs.manifold.asOriginal().trimByPlane(inputs.normal, inputs.originOffset);
|
|
192
|
+
}
|
|
82
193
|
}
|
|
@@ -1,20 +1,150 @@
|
|
|
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 ManifoldEvaluate {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
constructor(_wasm: Manifold3D.ManifoldToplevel);
|
|
9
|
+
/**
|
|
10
|
+
* Get surface area of manifold
|
|
11
|
+
* @param inputs manifold
|
|
12
|
+
* @returns surface area of manifold
|
|
13
|
+
* @group basic
|
|
14
|
+
* @shortname surface area
|
|
15
|
+
* @drawable false
|
|
16
|
+
*/
|
|
7
17
|
surfaceArea(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
18
|
+
/**
|
|
19
|
+
* Get volume of manifold
|
|
20
|
+
* @param inputs manifold
|
|
21
|
+
* @returns volume of manifold
|
|
22
|
+
* @group basic
|
|
23
|
+
* @shortname volume
|
|
24
|
+
* @drawable false
|
|
25
|
+
*/
|
|
26
|
+
volume(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
27
|
+
/**
|
|
28
|
+
* Check if manifold contains triangles
|
|
29
|
+
* @param inputs manifold
|
|
30
|
+
* @returns boolean indicating emptyness
|
|
31
|
+
* @group basic
|
|
32
|
+
* @shortname is empty
|
|
33
|
+
* @drawable false
|
|
34
|
+
*/
|
|
8
35
|
isEmpty(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Get number of vertices in manifold
|
|
38
|
+
* @param inputs manifold
|
|
39
|
+
* @returns number of vertices of manifold
|
|
40
|
+
* @group basic
|
|
41
|
+
* @shortname num vert
|
|
42
|
+
* @drawable false
|
|
43
|
+
*/
|
|
9
44
|
numVert(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
45
|
+
/**
|
|
46
|
+
* Get number of triangles in manifold
|
|
47
|
+
* @param inputs manifold
|
|
48
|
+
* @returns number of triangles of manifold
|
|
49
|
+
* @group basic
|
|
50
|
+
* @shortname num triangles
|
|
51
|
+
* @drawable false
|
|
52
|
+
*/
|
|
10
53
|
numTri(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
54
|
+
/**
|
|
55
|
+
* Get number of edges in manifold
|
|
56
|
+
* @param inputs manifold
|
|
57
|
+
* @returns number of edges of manifold
|
|
58
|
+
* @group basic
|
|
59
|
+
* @shortname num edges
|
|
60
|
+
* @drawable false
|
|
61
|
+
*/
|
|
11
62
|
numEdge(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
63
|
+
/**
|
|
64
|
+
* Get number of properties in manifold
|
|
65
|
+
* @param inputs manifold
|
|
66
|
+
* @returns number of properties of manifold
|
|
67
|
+
* @group basic
|
|
68
|
+
* @shortname num prop
|
|
69
|
+
* @drawable false
|
|
70
|
+
*/
|
|
12
71
|
numProp(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
72
|
+
/**
|
|
73
|
+
* The number of property vertices in the Manifold. This will always be >=
|
|
74
|
+
* numVert, as some physical vertices may be duplicated to account for
|
|
75
|
+
* different properties on different neighboring triangles.
|
|
76
|
+
* @param inputs manifold
|
|
77
|
+
* @returns number of properties of manifold
|
|
78
|
+
* @group basic
|
|
79
|
+
* @shortname num prop vert
|
|
80
|
+
* @drawable false
|
|
81
|
+
*/
|
|
13
82
|
numPropVert(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the axis-aligned bounding box of all the Manifold's vertices.
|
|
85
|
+
* @param inputs manifold
|
|
86
|
+
* @returns bounding box corner vectors of manifold
|
|
87
|
+
* @group basic
|
|
88
|
+
* @shortname bounding box
|
|
89
|
+
* @drawable false
|
|
90
|
+
*/
|
|
14
91
|
boundingBox(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): Inputs.Base.Vector3[];
|
|
92
|
+
/**
|
|
93
|
+
* Returns the tolerance of this Manifold's vertices, which tracks the
|
|
94
|
+
* approximate rounding error over all the transforms and operations that have
|
|
95
|
+
* led to this state. Any triangles that are colinear within this tolerance
|
|
96
|
+
* are considered degenerate and removed. This is the value of ε
|
|
97
|
+
* defining
|
|
98
|
+
* [ε-valid](https://github.com/elalish/manifold/wiki/Manifold-Library#definition-of-%CE%B5-valid).
|
|
99
|
+
* @param inputs manifold
|
|
100
|
+
* @returns tolerance of manifold
|
|
101
|
+
* @group basic
|
|
102
|
+
* @shortname tolerance
|
|
103
|
+
* @drawable false
|
|
104
|
+
*/
|
|
15
105
|
tolerance(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
106
|
+
/**
|
|
107
|
+
* The genus is a topological property of the manifold, representing the
|
|
108
|
+
* number of handles. A sphere is 0, torus 1, etc. It is only meaningful for
|
|
109
|
+
* a single mesh, so it is best to call Decompose() first.
|
|
110
|
+
* @param inputs manifold
|
|
111
|
+
* @returns genus of manifold
|
|
112
|
+
* @group basic
|
|
113
|
+
* @shortname genus
|
|
114
|
+
* @drawable false
|
|
115
|
+
*/
|
|
16
116
|
genus(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the minimum gap between two manifolds. Returns a float between
|
|
119
|
+
* 0 and searchLength.
|
|
120
|
+
* @param inputs two manifolds and search length
|
|
121
|
+
* @returns minimum
|
|
122
|
+
* @group basic
|
|
123
|
+
* @shortname min gap
|
|
124
|
+
* @drawable false
|
|
125
|
+
*/
|
|
17
126
|
minGap(inputs: Inputs.Manifold.ManifoldsMinGapDto<Manifold3D.Manifold>): number;
|
|
127
|
+
/**
|
|
128
|
+
* If this mesh is an original, this returns its ID that can be referenced
|
|
129
|
+
* by product manifolds. If this manifold is a product, this
|
|
130
|
+
* returns -1.
|
|
131
|
+
* @param inputs manifold
|
|
132
|
+
* @returns original id of manifold
|
|
133
|
+
* @group basic
|
|
134
|
+
* @shortname original id
|
|
135
|
+
* @drawable false
|
|
136
|
+
*/
|
|
18
137
|
originalID(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
138
|
+
/**
|
|
139
|
+
* Returns the reason for an input Mesh producing an empty Manifold. This
|
|
140
|
+
* Status will carry on through operations like NaN propogation, ensuring an
|
|
141
|
+
* errored mesh doesn't get mysteriously lost. Empty meshes may still show
|
|
142
|
+
* NoError, for instance the intersection of non-overlapping meshes.
|
|
143
|
+
* @param inputs manifold
|
|
144
|
+
* @returns error status string (NoError, NotManifold, InvalidConstruction, etc.)
|
|
145
|
+
* @group basic
|
|
146
|
+
* @shortname status
|
|
147
|
+
* @drawable false
|
|
148
|
+
*/
|
|
19
149
|
status(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): string;
|
|
20
150
|
}
|
|
@@ -1,47 +1,177 @@
|
|
|
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 ManifoldEvaluate {
|
|
2
|
-
constructor(
|
|
3
|
-
this.manifold = wasm;
|
|
4
|
-
}
|
|
5
|
-
volume(inputs) {
|
|
6
|
-
return inputs.manifold.volume();
|
|
6
|
+
constructor(_wasm) {
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Get surface area of manifold
|
|
10
|
+
* @param inputs manifold
|
|
11
|
+
* @returns surface area of manifold
|
|
12
|
+
* @group basic
|
|
13
|
+
* @shortname surface area
|
|
14
|
+
* @drawable false
|
|
15
|
+
*/
|
|
8
16
|
surfaceArea(inputs) {
|
|
9
17
|
return inputs.manifold.surfaceArea();
|
|
10
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Get volume of manifold
|
|
21
|
+
* @param inputs manifold
|
|
22
|
+
* @returns volume of manifold
|
|
23
|
+
* @group basic
|
|
24
|
+
* @shortname volume
|
|
25
|
+
* @drawable false
|
|
26
|
+
*/
|
|
27
|
+
volume(inputs) {
|
|
28
|
+
return inputs.manifold.volume();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if manifold contains triangles
|
|
32
|
+
* @param inputs manifold
|
|
33
|
+
* @returns boolean indicating emptyness
|
|
34
|
+
* @group basic
|
|
35
|
+
* @shortname is empty
|
|
36
|
+
* @drawable false
|
|
37
|
+
*/
|
|
11
38
|
isEmpty(inputs) {
|
|
12
39
|
return inputs.manifold.isEmpty();
|
|
13
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Get number of vertices in manifold
|
|
43
|
+
* @param inputs manifold
|
|
44
|
+
* @returns number of vertices of manifold
|
|
45
|
+
* @group basic
|
|
46
|
+
* @shortname num vert
|
|
47
|
+
* @drawable false
|
|
48
|
+
*/
|
|
14
49
|
numVert(inputs) {
|
|
15
50
|
return inputs.manifold.numVert();
|
|
16
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Get number of triangles in manifold
|
|
54
|
+
* @param inputs manifold
|
|
55
|
+
* @returns number of triangles of manifold
|
|
56
|
+
* @group basic
|
|
57
|
+
* @shortname num triangles
|
|
58
|
+
* @drawable false
|
|
59
|
+
*/
|
|
17
60
|
numTri(inputs) {
|
|
18
61
|
return inputs.manifold.numTri();
|
|
19
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Get number of edges in manifold
|
|
65
|
+
* @param inputs manifold
|
|
66
|
+
* @returns number of edges of manifold
|
|
67
|
+
* @group basic
|
|
68
|
+
* @shortname num edges
|
|
69
|
+
* @drawable false
|
|
70
|
+
*/
|
|
20
71
|
numEdge(inputs) {
|
|
21
72
|
return inputs.manifold.numEdge();
|
|
22
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Get number of properties in manifold
|
|
76
|
+
* @param inputs manifold
|
|
77
|
+
* @returns number of properties of manifold
|
|
78
|
+
* @group basic
|
|
79
|
+
* @shortname num prop
|
|
80
|
+
* @drawable false
|
|
81
|
+
*/
|
|
23
82
|
numProp(inputs) {
|
|
24
83
|
return inputs.manifold.numProp();
|
|
25
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* The number of property vertices in the Manifold. This will always be >=
|
|
87
|
+
* numVert, as some physical vertices may be duplicated to account for
|
|
88
|
+
* different properties on different neighboring triangles.
|
|
89
|
+
* @param inputs manifold
|
|
90
|
+
* @returns number of properties of manifold
|
|
91
|
+
* @group basic
|
|
92
|
+
* @shortname num prop vert
|
|
93
|
+
* @drawable false
|
|
94
|
+
*/
|
|
26
95
|
numPropVert(inputs) {
|
|
27
96
|
return inputs.manifold.numPropVert();
|
|
28
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns the axis-aligned bounding box of all the Manifold's vertices.
|
|
100
|
+
* @param inputs manifold
|
|
101
|
+
* @returns bounding box corner vectors of manifold
|
|
102
|
+
* @group basic
|
|
103
|
+
* @shortname bounding box
|
|
104
|
+
* @drawable false
|
|
105
|
+
*/
|
|
29
106
|
boundingBox(inputs) {
|
|
30
107
|
const bounds = inputs.manifold.boundingBox();
|
|
31
108
|
return [bounds.min, bounds.max];
|
|
32
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Returns the tolerance of this Manifold's vertices, which tracks the
|
|
112
|
+
* approximate rounding error over all the transforms and operations that have
|
|
113
|
+
* led to this state. Any triangles that are colinear within this tolerance
|
|
114
|
+
* are considered degenerate and removed. This is the value of ε
|
|
115
|
+
* defining
|
|
116
|
+
* [ε-valid](https://github.com/elalish/manifold/wiki/Manifold-Library#definition-of-%CE%B5-valid).
|
|
117
|
+
* @param inputs manifold
|
|
118
|
+
* @returns tolerance of manifold
|
|
119
|
+
* @group basic
|
|
120
|
+
* @shortname tolerance
|
|
121
|
+
* @drawable false
|
|
122
|
+
*/
|
|
33
123
|
tolerance(inputs) {
|
|
34
124
|
return inputs.manifold.tolerance();
|
|
35
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The genus is a topological property of the manifold, representing the
|
|
128
|
+
* number of handles. A sphere is 0, torus 1, etc. It is only meaningful for
|
|
129
|
+
* a single mesh, so it is best to call Decompose() first.
|
|
130
|
+
* @param inputs manifold
|
|
131
|
+
* @returns genus of manifold
|
|
132
|
+
* @group basic
|
|
133
|
+
* @shortname genus
|
|
134
|
+
* @drawable false
|
|
135
|
+
*/
|
|
36
136
|
genus(inputs) {
|
|
37
137
|
return inputs.manifold.genus();
|
|
38
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Returns the minimum gap between two manifolds. Returns a float between
|
|
141
|
+
* 0 and searchLength.
|
|
142
|
+
* @param inputs two manifolds and search length
|
|
143
|
+
* @returns minimum
|
|
144
|
+
* @group basic
|
|
145
|
+
* @shortname min gap
|
|
146
|
+
* @drawable false
|
|
147
|
+
*/
|
|
39
148
|
minGap(inputs) {
|
|
40
149
|
return inputs.manifold1.minGap(inputs.manifold2, inputs.searchLength);
|
|
41
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* If this mesh is an original, this returns its ID that can be referenced
|
|
153
|
+
* by product manifolds. If this manifold is a product, this
|
|
154
|
+
* returns -1.
|
|
155
|
+
* @param inputs manifold
|
|
156
|
+
* @returns original id of manifold
|
|
157
|
+
* @group basic
|
|
158
|
+
* @shortname original id
|
|
159
|
+
* @drawable false
|
|
160
|
+
*/
|
|
42
161
|
originalID(inputs) {
|
|
43
162
|
return inputs.manifold.originalID();
|
|
44
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Returns the reason for an input Mesh producing an empty Manifold. This
|
|
166
|
+
* Status will carry on through operations like NaN propogation, ensuring an
|
|
167
|
+
* errored mesh doesn't get mysteriously lost. Empty meshes may still show
|
|
168
|
+
* NoError, for instance the intersection of non-overlapping meshes.
|
|
169
|
+
* @param inputs manifold
|
|
170
|
+
* @returns error status string (NoError, NotManifold, InvalidConstruction, etc.)
|
|
171
|
+
* @group basic
|
|
172
|
+
* @shortname status
|
|
173
|
+
* @drawable false
|
|
174
|
+
*/
|
|
45
175
|
status(inputs) {
|
|
46
176
|
return inputs.manifold.status();
|
|
47
177
|
}
|