@bitbybit-dev/manifold 1.2.0 → 1.3.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/lib/api/inputs/manifold-inputs.d.ts +521 -224
- package/lib/api/inputs/manifold-inputs.js +380 -135
- package/lib/api/manifold-service.d.ts +37 -11
- package/lib/api/manifold-service.js +37 -11
- package/lib/api/services/cross-section/cross-section-booleans.d.ts +66 -29
- package/lib/api/services/cross-section/cross-section-booleans.js +66 -29
- package/lib/api/services/cross-section/cross-section-evaluate.d.ts +38 -17
- package/lib/api/services/cross-section/cross-section-evaluate.js +38 -17
- package/lib/api/services/cross-section/cross-section-operations.d.ts +73 -33
- package/lib/api/services/cross-section/cross-section-operations.js +73 -33
- package/lib/api/services/cross-section/cross-section-shapes.d.ts +38 -17
- package/lib/api/services/cross-section/cross-section-shapes.js +38 -17
- package/lib/api/services/cross-section/cross-section-transforms.d.ts +64 -29
- package/lib/api/services/cross-section/cross-section-transforms.js +64 -29
- package/lib/api/services/cross-section/cross-section.d.ts +81 -20
- package/lib/api/services/cross-section/cross-section.js +81 -20
- package/lib/api/services/manifold/manifold-booleans.d.ts +139 -43
- package/lib/api/services/manifold/manifold-booleans.js +143 -43
- package/lib/api/services/manifold/manifold-evaluate.d.ts +134 -59
- package/lib/api/services/manifold/manifold-evaluate.js +141 -59
- package/lib/api/services/manifold/manifold-operations.d.ts +195 -108
- package/lib/api/services/manifold/manifold-operations.js +197 -110
- package/lib/api/services/manifold/manifold-shapes.d.ts +64 -26
- package/lib/api/services/manifold/manifold-shapes.js +66 -28
- package/lib/api/services/manifold/manifold-transforms.d.ts +100 -38
- package/lib/api/services/manifold/manifold-transforms.js +100 -38
- package/lib/api/services/manifold/manifold.d.ts +25 -8
- package/lib/api/services/manifold/manifold.js +25 -8
- package/lib/api/services/mesh/mesh-evaluate.d.ts +103 -32
- package/lib/api/services/mesh/mesh-evaluate.js +108 -33
- package/lib/api/services/mesh/mesh-operations.d.ts +12 -15
- package/lib/api/services/mesh/mesh-operations.js +12 -15
- package/lib/api/services/mesh/mesh.d.ts +4 -2
- package/lib/api/services/mesh/mesh.js +4 -2
- package/package.json +3 -3
|
@@ -1,150 +1,225 @@
|
|
|
1
1
|
import * as Inputs from "../../inputs";
|
|
2
2
|
import * as Manifold3D from "manifold-3d";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Measuring Manifold solids and reading their bookkeeping: surface area and volume, vertex,
|
|
5
|
+
* triangle and edge counts, the bounding box, the tolerance, the genus, the gap to another solid,
|
|
6
|
+
* and the id and status the kernel tracks for every solid. Nothing here changes the solid.
|
|
6
7
|
*/
|
|
7
8
|
export declare class ManifoldEvaluate {
|
|
8
9
|
constructor(_wasm: Manifold3D.ManifoldToplevel);
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param inputs
|
|
12
|
-
* @returns surface area
|
|
11
|
+
* Measures the total surface area of a solid, in square model units.
|
|
12
|
+
* @param inputs - The solid
|
|
13
|
+
* @returns The surface area
|
|
13
14
|
* @group basic
|
|
14
15
|
* @shortname surface area
|
|
15
16
|
* @drawable false
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const area = await bitbybit.manifold.manifold.evaluate.surfaceArea({ manifold: cube });
|
|
20
|
+
* ```
|
|
16
21
|
*/
|
|
17
22
|
surfaceArea(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param inputs
|
|
21
|
-
* @returns volume
|
|
24
|
+
* Measures the volume of a solid, in cubic model units.
|
|
25
|
+
* @param inputs - The solid
|
|
26
|
+
* @returns The volume
|
|
22
27
|
* @group basic
|
|
23
28
|
* @shortname volume
|
|
24
29
|
* @drawable false
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const volume = await bitbybit.manifold.manifold.evaluate.volume({ manifold: cube });
|
|
33
|
+
* ```
|
|
25
34
|
*/
|
|
26
35
|
volume(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
37
|
+
* Tells whether a solid has no triangles at all, as the result of an intersection of shapes
|
|
38
|
+
* that do not overlap would.
|
|
39
|
+
* @param inputs - The solid
|
|
40
|
+
* @returns True when the solid is empty
|
|
31
41
|
* @group basic
|
|
32
42
|
* @shortname is empty
|
|
33
43
|
* @drawable false
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const empty = await bitbybit.manifold.manifold.evaluate.isEmpty({ manifold: shape });
|
|
47
|
+
* ```
|
|
34
48
|
*/
|
|
35
49
|
isEmpty(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): boolean;
|
|
36
50
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param inputs
|
|
39
|
-
* @returns number of vertices
|
|
51
|
+
* Counts the vertices of a solid's mesh, the corners its triangles share.
|
|
52
|
+
* @param inputs - The solid
|
|
53
|
+
* @returns The number of vertices
|
|
40
54
|
* @group basic
|
|
41
55
|
* @shortname num vert
|
|
42
56
|
* @drawable false
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const vertices = await bitbybit.manifold.manifold.evaluate.numVert({ manifold: shape });
|
|
60
|
+
* ```
|
|
43
61
|
*/
|
|
44
62
|
numVert(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
45
63
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param inputs
|
|
48
|
-
* @returns number of triangles
|
|
64
|
+
* Counts the triangles of a solid's mesh, which is its whole surface.
|
|
65
|
+
* @param inputs - The solid
|
|
66
|
+
* @returns The number of triangles
|
|
49
67
|
* @group basic
|
|
50
68
|
* @shortname num triangles
|
|
51
69
|
* @drawable false
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const triangles = await bitbybit.manifold.manifold.evaluate.numTri({ manifold: shape });
|
|
73
|
+
* ```
|
|
52
74
|
*/
|
|
53
75
|
numTri(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
54
76
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param inputs
|
|
57
|
-
* @returns number of edges
|
|
77
|
+
* Counts the edges of a solid's mesh, each shared by two triangles.
|
|
78
|
+
* @param inputs - The solid
|
|
79
|
+
* @returns The number of edges
|
|
58
80
|
* @group basic
|
|
59
81
|
* @shortname num edges
|
|
60
82
|
* @drawable false
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const edges = await bitbybit.manifold.manifold.evaluate.numEdge({ manifold: shape });
|
|
86
|
+
* ```
|
|
61
87
|
*/
|
|
62
88
|
numEdge(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
63
89
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param inputs
|
|
66
|
-
* @returns number of properties
|
|
90
|
+
* Counts the property channels each vertex of a solid carries; the position alone takes three.
|
|
91
|
+
* @param inputs - The solid
|
|
92
|
+
* @returns The number of properties per vertex
|
|
67
93
|
* @group basic
|
|
68
94
|
* @shortname num prop
|
|
69
95
|
* @drawable false
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const channels = await bitbybit.manifold.manifold.evaluate.numProp({ manifold: shape });
|
|
99
|
+
* ```
|
|
70
100
|
*/
|
|
71
101
|
numProp(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
72
102
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @param inputs
|
|
77
|
-
* @returns number of
|
|
103
|
+
* Counts the property vertices of a solid, which is at least `numVert`: a vertex whose
|
|
104
|
+
* neighboring triangles carry different properties, such as a sharp edge with two normals, is
|
|
105
|
+
* stored more than once.
|
|
106
|
+
* @param inputs - The solid
|
|
107
|
+
* @returns The number of property vertices
|
|
78
108
|
* @group basic
|
|
79
109
|
* @shortname num prop vert
|
|
80
110
|
* @drawable false
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const propVertices = await bitbybit.manifold.manifold.evaluate.numPropVert({ manifold: shape });
|
|
114
|
+
* ```
|
|
81
115
|
*/
|
|
82
116
|
numPropVert(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
83
117
|
/**
|
|
84
|
-
*
|
|
85
|
-
* @param inputs
|
|
86
|
-
* @returns
|
|
118
|
+
* Finds the axis-aligned box around every vertex of a solid.
|
|
119
|
+
* @param inputs - The solid
|
|
120
|
+
* @returns The minimum corner and the maximum corner
|
|
87
121
|
* @group basic
|
|
88
122
|
* @shortname bounding box
|
|
89
123
|
* @drawable false
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const [min, max] = await bitbybit.manifold.manifold.evaluate.boundingBox({ manifold: shape });
|
|
127
|
+
* ```
|
|
90
128
|
*/
|
|
91
129
|
boundingBox(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): Inputs.Base.Vector3[];
|
|
92
130
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* are
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @param inputs manifold
|
|
100
|
-
* @returns tolerance of manifold
|
|
131
|
+
* Reads the tolerance of a solid, the rounding error that has built up over the transforms and
|
|
132
|
+
* operations that made it.
|
|
133
|
+
*
|
|
134
|
+
* Triangles thinner than this are treated as degenerate and removed.
|
|
135
|
+
* @param inputs - The solid
|
|
136
|
+
* @returns The tolerance in model units
|
|
101
137
|
* @group basic
|
|
102
138
|
* @shortname tolerance
|
|
103
139
|
* @drawable false
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const tolerance = await bitbybit.manifold.manifold.evaluate.tolerance({ manifold: shape });
|
|
143
|
+
* ```
|
|
104
144
|
*/
|
|
105
145
|
tolerance(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
106
146
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* a single
|
|
110
|
-
*
|
|
111
|
-
* @
|
|
147
|
+
* Counts the holes through a solid, the way a ring has one and a sphere none.
|
|
148
|
+
*
|
|
149
|
+
* It only makes sense for a single connected piece, so run `operations.decompose` first on a
|
|
150
|
+
* solid made of several.
|
|
151
|
+
* @param inputs - The solid
|
|
152
|
+
* @returns The number of holes through the solid
|
|
112
153
|
* @group basic
|
|
113
154
|
* @shortname genus
|
|
114
155
|
* @drawable false
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const holes = await bitbybit.manifold.manifold.evaluate.genus({ manifold: shape });
|
|
159
|
+
* ```
|
|
115
160
|
*/
|
|
116
161
|
genus(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
117
162
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* @
|
|
163
|
+
* Measures the smallest distance between two solids, searching no farther than `searchLength`.
|
|
164
|
+
*
|
|
165
|
+
* The result is between 0 and the search length.
|
|
166
|
+
* @param inputs - The two solids and how far to search, in model units
|
|
167
|
+
* @returns The smallest gap between them
|
|
122
168
|
* @group basic
|
|
123
169
|
* @shortname min gap
|
|
124
170
|
* @drawable false
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const gap = await bitbybit.manifold.manifold.evaluate.minGap({ manifold1: cube, manifold2: sphere, searchLength: 100 });
|
|
174
|
+
* ```
|
|
125
175
|
*/
|
|
126
176
|
minGap(inputs: Inputs.Manifold.ManifoldsMinGapDto<Manifold3D.Manifold>): number;
|
|
127
177
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
178
|
+
* Shoots a ray segment from one point to another and lists every place it crosses the surface
|
|
179
|
+
* of a solid, nearest first; an empty list when it misses.
|
|
180
|
+
*
|
|
181
|
+
* A hit carries the point, the normal there, the original face id and its distance along the
|
|
182
|
+
* segment as a fraction of the segment's length.
|
|
183
|
+
* @param inputs - The solid, the start and the end of the ray segment
|
|
184
|
+
* @returns The hits sorted by distance
|
|
185
|
+
* @group spatial
|
|
186
|
+
* @shortname ray cast
|
|
187
|
+
* @drawable false
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const hits = await bitbybit.manifold.manifold.evaluate.rayCast({ manifold: shape, origin: [0, 10, 0], endpoint: [0, -10, 0] });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
rayCast(inputs: Inputs.Manifold.RayCastDto<Manifold3D.Manifold>): Inputs.Manifold.RayHit[];
|
|
194
|
+
/**
|
|
195
|
+
* Reads the id of a solid that is an original, as `operations.asOriginal` or a freshly built
|
|
196
|
+
* solid makes it; a solid produced from others by an operation reports -1.
|
|
197
|
+
* @param inputs - The solid
|
|
198
|
+
* @returns The original id, or -1
|
|
133
199
|
* @group basic
|
|
134
200
|
* @shortname original id
|
|
135
201
|
* @drawable false
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const id = await bitbybit.manifold.manifold.evaluate.originalID({ manifold: shape });
|
|
205
|
+
* ```
|
|
136
206
|
*/
|
|
137
207
|
originalID(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): number;
|
|
138
208
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* @
|
|
209
|
+
* Tells why a solid came out empty: `NoError`, or a reason such as `NotManifold` or
|
|
210
|
+
* `InvalidConstruction` when the mesh it was built from was not a closed surface.
|
|
211
|
+
*
|
|
212
|
+
* The status is carried through later operations, so a broken input does not get lost; an empty
|
|
213
|
+
* solid can still report `NoError`, as intersecting shapes that do not overlap does.
|
|
214
|
+
* @param inputs - The solid
|
|
215
|
+
* @returns The status name
|
|
145
216
|
* @group basic
|
|
146
217
|
* @shortname status
|
|
147
218
|
* @drawable false
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const status = await bitbybit.manifold.manifold.evaluate.status({ manifold: shape });
|
|
222
|
+
* ```
|
|
148
223
|
*/
|
|
149
224
|
status(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): string;
|
|
150
225
|
}
|
|
@@ -1,176 +1,258 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Measuring Manifold solids and reading their bookkeeping: surface area and volume, vertex,
|
|
3
|
+
* triangle and edge counts, the bounding box, the tolerance, the genus, the gap to another solid,
|
|
4
|
+
* and the id and status the kernel tracks for every solid. Nothing here changes the solid.
|
|
4
5
|
*/
|
|
5
6
|
export class ManifoldEvaluate {
|
|
6
7
|
constructor(_wasm) {
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param inputs
|
|
11
|
-
* @returns surface area
|
|
10
|
+
* Measures the total surface area of a solid, in square model units.
|
|
11
|
+
* @param inputs - The solid
|
|
12
|
+
* @returns The surface area
|
|
12
13
|
* @group basic
|
|
13
14
|
* @shortname surface area
|
|
14
15
|
* @drawable false
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const area = await bitbybit.manifold.manifold.evaluate.surfaceArea({ manifold: cube });
|
|
19
|
+
* ```
|
|
15
20
|
*/
|
|
16
21
|
surfaceArea(inputs) {
|
|
17
22
|
return inputs.manifold.surfaceArea();
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param inputs
|
|
22
|
-
* @returns volume
|
|
25
|
+
* Measures the volume of a solid, in cubic model units.
|
|
26
|
+
* @param inputs - The solid
|
|
27
|
+
* @returns The volume
|
|
23
28
|
* @group basic
|
|
24
29
|
* @shortname volume
|
|
25
30
|
* @drawable false
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const volume = await bitbybit.manifold.manifold.evaluate.volume({ manifold: cube });
|
|
34
|
+
* ```
|
|
26
35
|
*/
|
|
27
36
|
volume(inputs) {
|
|
28
37
|
return inputs.manifold.volume();
|
|
29
38
|
}
|
|
30
39
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
40
|
+
* Tells whether a solid has no triangles at all, as the result of an intersection of shapes
|
|
41
|
+
* that do not overlap would.
|
|
42
|
+
* @param inputs - The solid
|
|
43
|
+
* @returns True when the solid is empty
|
|
34
44
|
* @group basic
|
|
35
45
|
* @shortname is empty
|
|
36
46
|
* @drawable false
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const empty = await bitbybit.manifold.manifold.evaluate.isEmpty({ manifold: shape });
|
|
50
|
+
* ```
|
|
37
51
|
*/
|
|
38
52
|
isEmpty(inputs) {
|
|
39
53
|
return inputs.manifold.isEmpty();
|
|
40
54
|
}
|
|
41
55
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @param inputs
|
|
44
|
-
* @returns number of vertices
|
|
56
|
+
* Counts the vertices of a solid's mesh, the corners its triangles share.
|
|
57
|
+
* @param inputs - The solid
|
|
58
|
+
* @returns The number of vertices
|
|
45
59
|
* @group basic
|
|
46
60
|
* @shortname num vert
|
|
47
61
|
* @drawable false
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const vertices = await bitbybit.manifold.manifold.evaluate.numVert({ manifold: shape });
|
|
65
|
+
* ```
|
|
48
66
|
*/
|
|
49
67
|
numVert(inputs) {
|
|
50
68
|
return inputs.manifold.numVert();
|
|
51
69
|
}
|
|
52
70
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @param inputs
|
|
55
|
-
* @returns number of triangles
|
|
71
|
+
* Counts the triangles of a solid's mesh, which is its whole surface.
|
|
72
|
+
* @param inputs - The solid
|
|
73
|
+
* @returns The number of triangles
|
|
56
74
|
* @group basic
|
|
57
75
|
* @shortname num triangles
|
|
58
76
|
* @drawable false
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const triangles = await bitbybit.manifold.manifold.evaluate.numTri({ manifold: shape });
|
|
80
|
+
* ```
|
|
59
81
|
*/
|
|
60
82
|
numTri(inputs) {
|
|
61
83
|
return inputs.manifold.numTri();
|
|
62
84
|
}
|
|
63
85
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param inputs
|
|
66
|
-
* @returns number of edges
|
|
86
|
+
* Counts the edges of a solid's mesh, each shared by two triangles.
|
|
87
|
+
* @param inputs - The solid
|
|
88
|
+
* @returns The number of edges
|
|
67
89
|
* @group basic
|
|
68
90
|
* @shortname num edges
|
|
69
91
|
* @drawable false
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const edges = await bitbybit.manifold.manifold.evaluate.numEdge({ manifold: shape });
|
|
95
|
+
* ```
|
|
70
96
|
*/
|
|
71
97
|
numEdge(inputs) {
|
|
72
98
|
return inputs.manifold.numEdge();
|
|
73
99
|
}
|
|
74
100
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @param inputs
|
|
77
|
-
* @returns number of properties
|
|
101
|
+
* Counts the property channels each vertex of a solid carries; the position alone takes three.
|
|
102
|
+
* @param inputs - The solid
|
|
103
|
+
* @returns The number of properties per vertex
|
|
78
104
|
* @group basic
|
|
79
105
|
* @shortname num prop
|
|
80
106
|
* @drawable false
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const channels = await bitbybit.manifold.manifold.evaluate.numProp({ manifold: shape });
|
|
110
|
+
* ```
|
|
81
111
|
*/
|
|
82
112
|
numProp(inputs) {
|
|
83
113
|
return inputs.manifold.numProp();
|
|
84
114
|
}
|
|
85
115
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param inputs
|
|
90
|
-
* @returns number of
|
|
116
|
+
* Counts the property vertices of a solid, which is at least `numVert`: a vertex whose
|
|
117
|
+
* neighboring triangles carry different properties, such as a sharp edge with two normals, is
|
|
118
|
+
* stored more than once.
|
|
119
|
+
* @param inputs - The solid
|
|
120
|
+
* @returns The number of property vertices
|
|
91
121
|
* @group basic
|
|
92
122
|
* @shortname num prop vert
|
|
93
123
|
* @drawable false
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const propVertices = await bitbybit.manifold.manifold.evaluate.numPropVert({ manifold: shape });
|
|
127
|
+
* ```
|
|
94
128
|
*/
|
|
95
129
|
numPropVert(inputs) {
|
|
96
130
|
return inputs.manifold.numPropVert();
|
|
97
131
|
}
|
|
98
132
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @param inputs
|
|
101
|
-
* @returns
|
|
133
|
+
* Finds the axis-aligned box around every vertex of a solid.
|
|
134
|
+
* @param inputs - The solid
|
|
135
|
+
* @returns The minimum corner and the maximum corner
|
|
102
136
|
* @group basic
|
|
103
137
|
* @shortname bounding box
|
|
104
138
|
* @drawable false
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const [min, max] = await bitbybit.manifold.manifold.evaluate.boundingBox({ manifold: shape });
|
|
142
|
+
* ```
|
|
105
143
|
*/
|
|
106
144
|
boundingBox(inputs) {
|
|
107
145
|
const bounds = inputs.manifold.boundingBox();
|
|
108
146
|
return [bounds.min, bounds.max];
|
|
109
147
|
}
|
|
110
148
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* are
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* @param inputs manifold
|
|
118
|
-
* @returns tolerance of manifold
|
|
149
|
+
* Reads the tolerance of a solid, the rounding error that has built up over the transforms and
|
|
150
|
+
* operations that made it.
|
|
151
|
+
*
|
|
152
|
+
* Triangles thinner than this are treated as degenerate and removed.
|
|
153
|
+
* @param inputs - The solid
|
|
154
|
+
* @returns The tolerance in model units
|
|
119
155
|
* @group basic
|
|
120
156
|
* @shortname tolerance
|
|
121
157
|
* @drawable false
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const tolerance = await bitbybit.manifold.manifold.evaluate.tolerance({ manifold: shape });
|
|
161
|
+
* ```
|
|
122
162
|
*/
|
|
123
163
|
tolerance(inputs) {
|
|
124
164
|
return inputs.manifold.tolerance();
|
|
125
165
|
}
|
|
126
166
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* a single
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
167
|
+
* Counts the holes through a solid, the way a ring has one and a sphere none.
|
|
168
|
+
*
|
|
169
|
+
* It only makes sense for a single connected piece, so run `operations.decompose` first on a
|
|
170
|
+
* solid made of several.
|
|
171
|
+
* @param inputs - The solid
|
|
172
|
+
* @returns The number of holes through the solid
|
|
132
173
|
* @group basic
|
|
133
174
|
* @shortname genus
|
|
134
175
|
* @drawable false
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const holes = await bitbybit.manifold.manifold.evaluate.genus({ manifold: shape });
|
|
179
|
+
* ```
|
|
135
180
|
*/
|
|
136
181
|
genus(inputs) {
|
|
137
182
|
return inputs.manifold.genus();
|
|
138
183
|
}
|
|
139
184
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @
|
|
185
|
+
* Measures the smallest distance between two solids, searching no farther than `searchLength`.
|
|
186
|
+
*
|
|
187
|
+
* The result is between 0 and the search length.
|
|
188
|
+
* @param inputs - The two solids and how far to search, in model units
|
|
189
|
+
* @returns The smallest gap between them
|
|
144
190
|
* @group basic
|
|
145
191
|
* @shortname min gap
|
|
146
192
|
* @drawable false
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* const gap = await bitbybit.manifold.manifold.evaluate.minGap({ manifold1: cube, manifold2: sphere, searchLength: 100 });
|
|
196
|
+
* ```
|
|
147
197
|
*/
|
|
148
198
|
minGap(inputs) {
|
|
149
199
|
return inputs.manifold1.minGap(inputs.manifold2, inputs.searchLength);
|
|
150
200
|
}
|
|
151
201
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
202
|
+
* Shoots a ray segment from one point to another and lists every place it crosses the surface
|
|
203
|
+
* of a solid, nearest first; an empty list when it misses.
|
|
204
|
+
*
|
|
205
|
+
* A hit carries the point, the normal there, the original face id and its distance along the
|
|
206
|
+
* segment as a fraction of the segment's length.
|
|
207
|
+
* @param inputs - The solid, the start and the end of the ray segment
|
|
208
|
+
* @returns The hits sorted by distance
|
|
209
|
+
* @group spatial
|
|
210
|
+
* @shortname ray cast
|
|
211
|
+
* @drawable false
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* const hits = await bitbybit.manifold.manifold.evaluate.rayCast({ manifold: shape, origin: [0, 10, 0], endpoint: [0, -10, 0] });
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
rayCast(inputs) {
|
|
218
|
+
return inputs.manifold.rayCast(inputs.origin, inputs.endpoint).map((hit) => ({
|
|
219
|
+
faceID: hit.faceID,
|
|
220
|
+
distance: hit.distance,
|
|
221
|
+
position: [...hit.position],
|
|
222
|
+
normal: [...hit.normal],
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Reads the id of a solid that is an original, as `operations.asOriginal` or a freshly built
|
|
227
|
+
* solid makes it; a solid produced from others by an operation reports -1.
|
|
228
|
+
* @param inputs - The solid
|
|
229
|
+
* @returns The original id, or -1
|
|
157
230
|
* @group basic
|
|
158
231
|
* @shortname original id
|
|
159
232
|
* @drawable false
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* const id = await bitbybit.manifold.manifold.evaluate.originalID({ manifold: shape });
|
|
236
|
+
* ```
|
|
160
237
|
*/
|
|
161
238
|
originalID(inputs) {
|
|
162
239
|
return inputs.manifold.originalID();
|
|
163
240
|
}
|
|
164
241
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* @
|
|
242
|
+
* Tells why a solid came out empty: `NoError`, or a reason such as `NotManifold` or
|
|
243
|
+
* `InvalidConstruction` when the mesh it was built from was not a closed surface.
|
|
244
|
+
*
|
|
245
|
+
* The status is carried through later operations, so a broken input does not get lost; an empty
|
|
246
|
+
* solid can still report `NoError`, as intersecting shapes that do not overlap does.
|
|
247
|
+
* @param inputs - The solid
|
|
248
|
+
* @returns The status name
|
|
171
249
|
* @group basic
|
|
172
250
|
* @shortname status
|
|
173
251
|
* @drawable false
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const status = await bitbybit.manifold.manifold.evaluate.status({ manifold: shape });
|
|
255
|
+
* ```
|
|
174
256
|
*/
|
|
175
257
|
status(inputs) {
|
|
176
258
|
return inputs.manifold.status();
|