@meshinspector/meshlib 3.1.3-337 → 3.1.4-297
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 +64 -18
- package/bindings.d.mts +1696 -163
- package/index.d.mts +11 -174
- package/meshlib.mjs +123 -136
- package/meshlib.node.mjs +151 -160
- package/meshlib.node.wasm +0 -0
- package/meshlib.wasm +0 -0
- package/package.json +1 -1
package/bindings.d.mts
CHANGED
|
@@ -34,19 +34,40 @@ export interface ClassHandle {
|
|
|
34
34
|
[Symbol.dispose](): void;
|
|
35
35
|
clone(): this;
|
|
36
36
|
}
|
|
37
|
+
export interface NoiseSettings extends ClassHandle {
|
|
38
|
+
sigma: number;
|
|
39
|
+
seed: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
export interface AffineXf3f extends ClassHandle {
|
|
38
43
|
A: Matrix3f;
|
|
39
44
|
b: Vector3f;
|
|
40
|
-
mul(
|
|
41
|
-
apply(
|
|
45
|
+
mul(b: AffineXf3f): AffineXf3f;
|
|
46
|
+
apply(v: Vector3f): Vector3f;
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
/**
|
|
50
|
+
* std::vector<bool> like container (random-access, size_t - index type, bool - value type) with all bits after size() considered off during testing
|
|
51
|
+
*/
|
|
44
52
|
export interface BitSet extends ClassHandle {
|
|
45
53
|
size(): number;
|
|
54
|
+
/**
|
|
55
|
+
* @brief computes the number of set bits in the whole set
|
|
56
|
+
*/
|
|
46
57
|
count(): number;
|
|
47
58
|
empty(): boolean;
|
|
48
|
-
test(
|
|
49
|
-
|
|
59
|
+
test(n: number): boolean;
|
|
60
|
+
set(n: number, val: boolean): void;
|
|
61
|
+
resize(numBits: number, fillValue: boolean): void;
|
|
62
|
+
/**
|
|
63
|
+
* @brief return the smallest index i such that bit i is set, or npos if *this has no on bits.
|
|
64
|
+
*/
|
|
65
|
+
find_first(): number;
|
|
66
|
+
/**
|
|
67
|
+
* @brief return the highest index i such that bit i is set, or npos if *this has no on bits.
|
|
68
|
+
*/
|
|
69
|
+
find_last(): number;
|
|
70
|
+
toIndices(): Uint32Array;
|
|
50
71
|
}
|
|
51
72
|
|
|
52
73
|
export interface FaceBitSet extends BitSet {
|
|
@@ -79,6 +100,25 @@ export interface Box3i extends ClassHandle {
|
|
|
79
100
|
size(): Vector3i;
|
|
80
101
|
}
|
|
81
102
|
|
|
103
|
+
export interface DistanceFromWeightedPointsParams extends ClassHandle {
|
|
104
|
+
/**
|
|
105
|
+
* minimal weight among all points in the cloud; if this value is imprecise, then more computations will be made by algorithm
|
|
106
|
+
*/
|
|
107
|
+
minWeight: number;
|
|
108
|
+
/**
|
|
109
|
+
* maximal weight among all points in the cloud; if this value is imprecise, then more computations will be made by algorithm
|
|
110
|
+
*/
|
|
111
|
+
maxWeight: number;
|
|
112
|
+
/**
|
|
113
|
+
* maximal magnitude of gradient of points' weight in the cloud, >=0; if maxWeightGrad < 1 then more search optimizations can be done
|
|
114
|
+
*/
|
|
115
|
+
maxWeightGrad: number;
|
|
116
|
+
/**
|
|
117
|
+
* for points, it must always true; for triangles: if true the distances grow in both directions from each triangle, reaching minimum in the triangle; if false the distances grow to infinity in the direction of triangle's normals, and decrease to minus infinity in the opposite direction
|
|
118
|
+
*/
|
|
119
|
+
bidirectionalMode: boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
82
122
|
export type Color = {
|
|
83
123
|
r: number,
|
|
84
124
|
g: number,
|
|
@@ -86,33 +126,72 @@ export type Color = {
|
|
|
86
126
|
a: number
|
|
87
127
|
};
|
|
88
128
|
|
|
129
|
+
/**
|
|
130
|
+
* This structure contains result of MR::cutMesh function
|
|
131
|
+
*/
|
|
132
|
+
type CutMeshResult = {
|
|
133
|
+
/**
|
|
134
|
+
* @brief Paths of new edges on mesh, they represent same contours as input, but already cut.
|
|
135
|
+
*/
|
|
136
|
+
resultCut: Uint32Array[];
|
|
137
|
+
/**
|
|
138
|
+
* Bitset of bad triangles - triangles where input contours have intersections and cannot be cut and filled in a good way @see MR::CutMeshParameters
|
|
139
|
+
*/
|
|
140
|
+
fbsWithContourIntersections: FaceBitSet;
|
|
141
|
+
};
|
|
142
|
+
|
|
89
143
|
export interface FillPartValue<T extends number> {
|
|
90
144
|
value: T;
|
|
91
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Caller can avoid filling non-needed part of cut faces to speedup cutting still add pseudo FaceId to opposite side to keep connectivity
|
|
148
|
+
*/
|
|
92
149
|
export type FillPart = FillPartValue<0>|FillPartValue<1>|FillPartValue<2>;
|
|
93
150
|
|
|
94
151
|
export interface ForceFillValue<T extends number> {
|
|
95
152
|
value: T;
|
|
96
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* This enum defines the MR::cutMesh behaviour in case of bad faces acure basicaly MR::cutMesh removes all faces which contours pass through, adds new edges to topology and fills all removed parts
|
|
156
|
+
*
|
|
157
|
+
* @note Bad faces here mean faces where contours have intersections and cannot be cut and filled in an good way
|
|
158
|
+
*/
|
|
97
159
|
export type ForceFill = ForceFillValue<0>|ForceFillValue<1>|ForceFillValue<2>;
|
|
98
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @brief Parameters of MR::cutMesh.
|
|
163
|
+
*
|
|
164
|
+
* This structure contains some options and optional outputs of MR::cutMesh function @see MR::CutMeshResult
|
|
165
|
+
*/
|
|
99
166
|
export interface CutMeshParameters extends ClassHandle {
|
|
100
167
|
fillPart: FillPart;
|
|
101
168
|
forceFillMode: ForceFill;
|
|
102
169
|
}
|
|
103
170
|
|
|
171
|
+
/**
|
|
172
|
+
* @brief Settings structurer for cutMeshByProjection function.
|
|
173
|
+
*/
|
|
104
174
|
export interface CutByProjectionSettings extends ClassHandle {
|
|
175
|
+
/**
|
|
176
|
+
* @brief direction of projection (in mesh space)
|
|
177
|
+
*/
|
|
105
178
|
direction: Vector3f;
|
|
106
179
|
}
|
|
107
180
|
|
|
108
181
|
export interface EdgeWeightsValue<T extends number> {
|
|
109
182
|
value: T;
|
|
110
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* @brief determines the weight of each edge in applications like Laplacian
|
|
186
|
+
*/
|
|
111
187
|
export type EdgeWeights = EdgeWeightsValue<0>|EdgeWeightsValue<1>;
|
|
112
188
|
|
|
113
189
|
export interface VertexMassValue<T extends number> {
|
|
114
190
|
value: T;
|
|
115
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* @brief determines the weight or mass of each vertex in applications like Laplacian
|
|
194
|
+
*/
|
|
116
195
|
export type VertexMass = VertexMassValue<0>|VertexMassValue<1>;
|
|
117
196
|
|
|
118
197
|
export interface RememberShapeValue<T extends number> {
|
|
@@ -125,64 +204,138 @@ export interface OffsetModeValue<T extends number> {
|
|
|
125
204
|
}
|
|
126
205
|
export type OffsetMode = OffsetModeValue<0>|OffsetModeValue<1>|OffsetModeValue<2>;
|
|
127
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @brief a pair of faces
|
|
209
|
+
*/
|
|
210
|
+
type FaceFace = { aFace: number; bFace: number };
|
|
211
|
+
|
|
128
212
|
export interface SubdivideFillingSettings extends ClassHandle {
|
|
213
|
+
/**
|
|
214
|
+
* @brief Subdivision is stopped when all edges inside or on the boundary of the region are not longer than this value.
|
|
215
|
+
*/
|
|
129
216
|
maxEdgeLen: number;
|
|
217
|
+
/**
|
|
218
|
+
* @brief Maximum number of edge splits allowed during subdivision.
|
|
219
|
+
*/
|
|
130
220
|
maxEdgeSplits: number;
|
|
221
|
+
/**
|
|
222
|
+
* @brief Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than on this value (in radians)
|
|
223
|
+
*/
|
|
131
224
|
maxAngleChangeAfterFlip: number;
|
|
132
225
|
}
|
|
133
226
|
|
|
134
227
|
export interface SmoothFillingSettings extends ClassHandle {
|
|
228
|
+
/**
|
|
229
|
+
* @brief Additionally smooth 3 layers of vertices near hole boundary both inside and outside of the hole.
|
|
230
|
+
*/
|
|
135
231
|
naturalSmooth: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* @brief edge weighting scheme for smoothCurvature mode
|
|
234
|
+
*/
|
|
136
235
|
edgeWeights: EdgeWeights;
|
|
236
|
+
/**
|
|
237
|
+
* @brief vertex mass scheme for smoothCurvature mode
|
|
238
|
+
*/
|
|
137
239
|
vmass: VertexMass;
|
|
138
240
|
}
|
|
139
241
|
|
|
140
242
|
export interface FillHoleNicelySettings extends ClassHandle {
|
|
243
|
+
/**
|
|
244
|
+
* @brief If false then additional vertices are created inside the patch for best mesh quality.
|
|
245
|
+
*/
|
|
141
246
|
triangulateOnly: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* @brief if `triangulateOnly` is false - this settings are used to subdivide new filling
|
|
249
|
+
*/
|
|
142
250
|
subdivideSettings: SubdivideFillingSettings;
|
|
251
|
+
/**
|
|
252
|
+
* @brief Whether to make patch over the hole smooth both inside and on its boundary with existed surface.
|
|
253
|
+
*/
|
|
143
254
|
smoothCurvature: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* @brief if `smoothCurvature` is true and `triangulateOnly is false - these settings are used to smooth new filling
|
|
257
|
+
*/
|
|
144
258
|
smoothSettings: SmoothFillingSettings;
|
|
259
|
+
/**
|
|
260
|
+
* @brief how to triangulate the hole, must be specified by the user
|
|
261
|
+
*/
|
|
145
262
|
triangulateParams: FillHoleParams;
|
|
146
263
|
}
|
|
147
264
|
|
|
148
265
|
export interface SelfIntersectionsMethodValue<T extends number> {
|
|
149
266
|
value: T;
|
|
150
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* @brief Fix method.
|
|
270
|
+
*/
|
|
151
271
|
export type SelfIntersectionsMethod = SelfIntersectionsMethodValue<0>|SelfIntersectionsMethodValue<1>;
|
|
152
272
|
|
|
273
|
+
/**
|
|
274
|
+
* @brief Setting set for mesh self-intersections fix.
|
|
275
|
+
*/
|
|
153
276
|
export interface SelfIntersectionsSettings extends ClassHandle {
|
|
277
|
+
/**
|
|
278
|
+
* @brief If true then count touching faces as self-intersections.
|
|
279
|
+
*/
|
|
154
280
|
touchIsIntersection: boolean;
|
|
155
281
|
method: SelfIntersectionsMethod;
|
|
282
|
+
/**
|
|
283
|
+
* @brief Maximum relax iterations.
|
|
284
|
+
*/
|
|
156
285
|
relaxIterations: number;
|
|
286
|
+
/**
|
|
287
|
+
* @brief Maximum expand count (edge steps from self-intersecting faces), should be >= 0.
|
|
288
|
+
*/
|
|
157
289
|
maxExpand: number;
|
|
290
|
+
/**
|
|
291
|
+
* Edge length for subdivision of holes covers (0.0f means auto) FLT_MAX to disable subdivision
|
|
292
|
+
*/
|
|
158
293
|
subdivideEdgeLen: number;
|
|
294
|
+
/**
|
|
295
|
+
* @brief trying to stay close to initial surface when patching
|
|
296
|
+
*/
|
|
159
297
|
mimicPatch: boolean;
|
|
160
|
-
|
|
298
|
+
/**
|
|
299
|
+
* @brief Callback function.
|
|
300
|
+
*/
|
|
301
|
+
callback: ( progress: number ) => boolean;
|
|
161
302
|
}
|
|
162
303
|
|
|
163
304
|
export interface SelfIntersections extends ClassHandle {
|
|
164
305
|
}
|
|
165
306
|
|
|
307
|
+
/**
|
|
308
|
+
* @brief wrapper class that helps mrbind to avoid excess MRVDBFloatGrid.h includes
|
|
309
|
+
*/
|
|
166
310
|
export interface FloatGrid extends ClassHandle {
|
|
167
311
|
}
|
|
168
312
|
|
|
313
|
+
/**
|
|
314
|
+
* @brief Class for deforming mesh using Bernstein interpolation.
|
|
315
|
+
*/
|
|
169
316
|
export interface FreeFormDeformer extends ClassHandle {
|
|
170
317
|
init(): void;
|
|
171
318
|
apply(): void;
|
|
172
|
-
init(
|
|
173
|
-
init(
|
|
174
|
-
setRefGridPointPosition(
|
|
175
|
-
getRefGridPointPosition(
|
|
319
|
+
init(resolution: Vector3i): void;
|
|
320
|
+
init(resolution: Vector3i, initialBox: Box3f): void;
|
|
321
|
+
setRefGridPointPosition(coordOfPointInGrid: Vector3i, newPos: Vector3f): void;
|
|
322
|
+
getRefGridPointPosition(coordOfPointInGrid: Vector3i): Vector3f;
|
|
176
323
|
}
|
|
177
324
|
|
|
178
325
|
export interface ICPMethodValue<T extends number> {
|
|
179
326
|
value: T;
|
|
180
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* @brief The method how to update transformation from point pairs.
|
|
330
|
+
*/
|
|
181
331
|
export type ICPMethod = ICPMethodValue<0>|ICPMethodValue<1>|ICPMethodValue<2>;
|
|
182
332
|
|
|
183
333
|
export interface ICPModeValue<T extends number> {
|
|
184
334
|
value: T;
|
|
185
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* @brief The group of transformations, each with its own degrees of freedom.
|
|
338
|
+
*/
|
|
186
339
|
export type ICPMode = ICPModeValue<0>|ICPModeValue<1>|ICPModeValue<2>|ICPModeValue<3>|ICPModeValue<4>;
|
|
187
340
|
|
|
188
341
|
export interface ICPExitTypeValue<T extends number> {
|
|
@@ -190,44 +343,140 @@ export interface ICPExitTypeValue<T extends number> {
|
|
|
190
343
|
}
|
|
191
344
|
export type ICPExitType = ICPExitTypeValue<0>|ICPExitTypeValue<1>|ICPExitTypeValue<2>|ICPExitTypeValue<3>|ICPExitTypeValue<4>;
|
|
192
345
|
|
|
346
|
+
/**
|
|
347
|
+
* @brief parameters of ICP algorithm
|
|
348
|
+
*/
|
|
193
349
|
export interface ICPProperties extends ClassHandle {
|
|
350
|
+
/**
|
|
351
|
+
* @brief The method how to update transformation from point pairs, see description of each option in ICPMethod.
|
|
352
|
+
*/
|
|
194
353
|
method: ICPMethod;
|
|
354
|
+
/**
|
|
355
|
+
* Rotation angle during one iteration of ICPMethod::PointToPlane will be limited by this value. This is to reduce possible instability.
|
|
356
|
+
*/
|
|
195
357
|
p2plAngleLimit: number;
|
|
358
|
+
/**
|
|
359
|
+
* Scaling during one iteration of ICPMethod::PointToPlane will be limited by this value. This is to reduce possible instability.
|
|
360
|
+
*/
|
|
196
361
|
p2plScaleLimit: number;
|
|
362
|
+
/**
|
|
363
|
+
* If source and target points in a pair both have normals, then dot-product of normals must be not smaller than (cosThreshold), otherwise such point pair will be deactivated (ignored) during transformation computation. This is to get rid of erroneous pairs on unrelated parts of objects, which are close only by chance.
|
|
364
|
+
*/
|
|
197
365
|
cosThreshold: number;
|
|
366
|
+
/**
|
|
367
|
+
* The squared distance between source and target points in a pair must be not greater than (distThresholdSq), otherwise such point pair will be deactivated (ignored) during transformation computation. This is to get rid of outliers in input objects.
|
|
368
|
+
*/
|
|
198
369
|
distThresholdSq: number;
|
|
370
|
+
/**
|
|
371
|
+
* First, root-mean-square distance between points in all active pairs is computed as D. Then, the distance between source and target points in a pair must be not greater than (farDistFactor * D), otherwise such point pair will be deactivated (ignored) during transformation computation. This is to progressively reduce the distance threshold as the algorithm converge to a solution.
|
|
372
|
+
*/
|
|
199
373
|
farDistFactor: number;
|
|
374
|
+
/**
|
|
375
|
+
* Selects the group of transformations, where to find a solution (e.g. with scaling or without, with rotation or without, ...). See the description of each option in ICPMode.
|
|
376
|
+
*/
|
|
200
377
|
icpMode: ICPMode;
|
|
378
|
+
/**
|
|
379
|
+
* The maximum number of iterations that the algorithm can perform. Increase this parameter if you need a higher precision or if initial approximation is not very precise.
|
|
380
|
+
*/
|
|
201
381
|
iterLimit: number;
|
|
382
|
+
/**
|
|
383
|
+
* The algorithm will stop before making all (iterLimit) iterations, if there were consecutive (badIterStopCount) iterations, during which the average distance between points in active pairs did not diminish.
|
|
384
|
+
*/
|
|
202
385
|
badIterStopCount: number;
|
|
386
|
+
/**
|
|
387
|
+
* The algorithm will stop before making all (iterLimit) iterations, if the average distance between points in active pairs became smaller than this value.
|
|
388
|
+
*/
|
|
203
389
|
exitVal: number;
|
|
390
|
+
/**
|
|
391
|
+
* A pair of points is activated only if both points in the pair are mutually closest (reciprocity test passed), some papers recommend this mode for filtering out wrong pairs, but it can be too aggressive and deactivate (almost) all pairs.
|
|
392
|
+
*/
|
|
204
393
|
mutualClosest: boolean;
|
|
394
|
+
/**
|
|
395
|
+
* @brief if this flag is true and a source point finds its correspondence on a boundary of target object, then ignores such pair
|
|
396
|
+
*/
|
|
205
397
|
ignoreBdTgts: boolean;
|
|
398
|
+
/**
|
|
399
|
+
* @brief Additional parameter for ICPMode::OrthogonalAxis and ICPMode::FixedAxis transformation groups.
|
|
400
|
+
*/
|
|
206
401
|
fixedRotationAxis: Vector3f;
|
|
207
402
|
}
|
|
208
403
|
|
|
404
|
+
/**
|
|
405
|
+
* This class allows you to register two object with similar shape using Iterative Closest Points (ICP) point-to-point or point-to-plane algorithms
|
|
406
|
+
*/
|
|
209
407
|
export interface ICP extends ClassHandle {
|
|
210
|
-
|
|
211
|
-
|
|
408
|
+
/**
|
|
409
|
+
* @brief tune algorithm params before run calculateTransformation()
|
|
410
|
+
*/
|
|
411
|
+
setParams(prop: ICPProperties): void;
|
|
412
|
+
/**
|
|
413
|
+
* @brief select pairs with origin samples on both objects
|
|
414
|
+
*/
|
|
415
|
+
samplePoints(samplingVoxelSize: number): void;
|
|
416
|
+
/**
|
|
417
|
+
* automatically selects initial transformation for the floating object based on covariance matrices of both floating and reference objects; applies the transformation to the floating object and returns it
|
|
418
|
+
*/
|
|
212
419
|
autoSelectFloatXf(): AffineXf3f;
|
|
420
|
+
/**
|
|
421
|
+
* @brief recompute point pairs after manual change of transformations or parameters
|
|
422
|
+
*/
|
|
213
423
|
updatePointPairs(): void;
|
|
214
424
|
getStatusInfo(): string;
|
|
425
|
+
/**
|
|
426
|
+
* @brief computes the number of samples able to form pairs
|
|
427
|
+
*/
|
|
215
428
|
getNumSamples(): number;
|
|
429
|
+
/**
|
|
430
|
+
* @brief computes the number of active point pairs
|
|
431
|
+
*/
|
|
216
432
|
getNumActivePairs(): number;
|
|
433
|
+
/**
|
|
434
|
+
* @brief computes root-mean-square deviation between points
|
|
435
|
+
*/
|
|
217
436
|
getMeanSqDistToPoint(): number;
|
|
437
|
+
/**
|
|
438
|
+
* @brief computes root-mean-square deviation from points to target planes
|
|
439
|
+
*/
|
|
218
440
|
getMeanSqDistToPlane(): number;
|
|
441
|
+
/**
|
|
442
|
+
* runs ICP algorithm given input objects, transformations, and parameters; @returns adjusted transformation of the floating object to match reference object
|
|
443
|
+
*/
|
|
219
444
|
calculateTransformation(): AffineXf3f;
|
|
220
445
|
}
|
|
221
446
|
|
|
222
447
|
export interface ContinuousContours extends ClassHandle {
|
|
223
448
|
}
|
|
224
449
|
|
|
450
|
+
/**
|
|
451
|
+
* Laplacian to smoothly deform a region preserving mesh fine details. How to use:
|
|
452
|
+
* 1. Initialize Laplacian for the region being deformed, here region properties are remembered.
|
|
453
|
+
* 2. Change positions of some vertices within the region and call fixVertex for them.
|
|
454
|
+
* 3. Optionally call updateSolver()
|
|
455
|
+
* 4. Call apply() to change the remaining vertices within the region Then steps 1-4 or 2-4 can be repeated.
|
|
456
|
+
*/
|
|
225
457
|
export interface Laplacian extends ClassHandle {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
458
|
+
/**
|
|
459
|
+
* (re)initialize Laplacian for the region being deformed, here region properties are remembered and precomputed; @param freeVerts must not include all vertices of a mesh connected component;
|
|
460
|
+
* @param usePoints is not nullptr, then these points will be used instead of passed to a constructor for weights computation and shape memory
|
|
461
|
+
*/
|
|
462
|
+
init(freeVerts: VertBitSet, weights: EdgeWeights): void;
|
|
463
|
+
/**
|
|
464
|
+
* (re)initialize Laplacian for the region being deformed, here region properties are remembered and precomputed; @param freeVerts must not include all vertices of a mesh connected component;
|
|
465
|
+
* @param usePoints is not nullptr, then these points will be used instead of passed to a constructor for weights computation and shape memory
|
|
466
|
+
*/
|
|
467
|
+
init(freeVerts: VertBitSet, weights: EdgeWeights, vmass: VertexMass, rem: RememberShape): void;
|
|
468
|
+
/**
|
|
469
|
+
* notify Laplacian that given vertex has changed after init and must be fixed during apply; @param smooth whether to make the surface smooth in this vertex (sharp otherwise)
|
|
470
|
+
*/
|
|
471
|
+
fixVertex(v: number, smooth: boolean): void;
|
|
472
|
+
/**
|
|
473
|
+
* takes fixed vertex positions from the points vector passed to a constructor, computes and writes free vertex positions in the points vector passed to a constructor as well
|
|
474
|
+
*/
|
|
229
475
|
apply(): void;
|
|
230
|
-
|
|
476
|
+
/**
|
|
477
|
+
* notify Laplacian that given vertex has changed after init and must be fixed during apply; @param smooth whether to make the surface smooth in this vertex (sharp otherwise)
|
|
478
|
+
*/
|
|
479
|
+
fixVertex(v: number, fixedPos: Vector3f, smooth: boolean): void;
|
|
231
480
|
}
|
|
232
481
|
|
|
233
482
|
export type SphereParams = {
|
|
@@ -241,59 +490,189 @@ export interface Matrix3f extends ClassHandle {
|
|
|
241
490
|
z: Vector3f;
|
|
242
491
|
}
|
|
243
492
|
|
|
493
|
+
/**
|
|
494
|
+
* This class represents a mesh, including topology (connectivity) information and point coordinates, as well as some caches to accelerate search algorithms
|
|
495
|
+
*/
|
|
244
496
|
export interface Mesh extends ClassHandle {
|
|
245
497
|
readonly topology: MeshTopology;
|
|
246
|
-
|
|
498
|
+
points: VertCoords;
|
|
499
|
+
/**
|
|
500
|
+
* @brief tightly packs all arrays eliminating lone edges and invalid faces, vertices and points
|
|
501
|
+
*/
|
|
247
502
|
pack(): void;
|
|
503
|
+
/**
|
|
504
|
+
* packs tightly and rearranges vertices, triangles and edges to put close in space elements in close indices @param preserveAABBTree whether to keep valid mesh's AABB tree after return (it will take longer to compute and it will occupy more memory)
|
|
505
|
+
*/
|
|
506
|
+
packOptimally(): void;
|
|
507
|
+
/**
|
|
508
|
+
* returns volume of the object surrounded by given region (or whole mesh if (region) is nullptr); if the region has holes then each hole will be virtually filled by adding triangles for each edge and the hole's geometrical center
|
|
509
|
+
*/
|
|
248
510
|
volume(): number;
|
|
511
|
+
/**
|
|
512
|
+
* @brief returns the area of given face
|
|
513
|
+
*/
|
|
249
514
|
area(): number;
|
|
515
|
+
/**
|
|
516
|
+
* passes through all valid vertices and finds the minimal bounding box containing all of them; if toWorld transformation is given then returns minimal bounding box in world space
|
|
517
|
+
*/
|
|
250
518
|
computeBoundingBox(): Box3f;
|
|
519
|
+
/**
|
|
520
|
+
* invalidates caches (aabb-trees) after any change in mesh geometry or topology @param pointsChanged specifies whether points have changed (otherwise only topology has changed)
|
|
521
|
+
*/
|
|
251
522
|
invalidateCaches(): void;
|
|
252
|
-
|
|
523
|
+
/**
|
|
524
|
+
* applies given transformation to specified vertices if region is nullptr, all valid mesh vertices are used
|
|
525
|
+
*/
|
|
526
|
+
transform(xf: AffineXf3f): void;
|
|
527
|
+
/**
|
|
528
|
+
* @brief computes average length of an edge in this mesh
|
|
529
|
+
*/
|
|
253
530
|
averageEdgeLength(): number;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
531
|
+
/**
|
|
532
|
+
* @brief appends another mesh as separate connected component(s) to this
|
|
533
|
+
*/
|
|
534
|
+
addMesh(from: Mesh | null): void;
|
|
535
|
+
/**
|
|
536
|
+
* @brief returns Euclidean length of the edge
|
|
537
|
+
*/
|
|
538
|
+
edgeLength(e: number): number;
|
|
539
|
+
/**
|
|
540
|
+
* @brief returns squared Euclidean length of the edge (faster to compute than length)
|
|
541
|
+
*/
|
|
542
|
+
edgeLengthSq(e: number): number;
|
|
543
|
+
/**
|
|
544
|
+
* @brief computes triangular face normal from its vertices
|
|
545
|
+
*/
|
|
546
|
+
normal(v: number): Vector3f;
|
|
547
|
+
/**
|
|
548
|
+
* @brief computes average position of all valid mesh vertices
|
|
549
|
+
*/
|
|
257
550
|
findCenterFromPoints(): Vector3f;
|
|
551
|
+
/**
|
|
552
|
+
* @brief computes center of mass considering that density of all triangles is the same
|
|
553
|
+
*/
|
|
258
554
|
findCenterFromFaces(): Vector3f;
|
|
555
|
+
/**
|
|
556
|
+
* @brief computes bounding box and returns its center
|
|
557
|
+
*/
|
|
259
558
|
findCenterFromBBox(): Vector3f;
|
|
260
|
-
|
|
559
|
+
/**
|
|
560
|
+
* @brief converts vertex into barycentric representation
|
|
561
|
+
*/
|
|
562
|
+
toTriPoint(f: number, p: Vector3f): MeshTriPoint;
|
|
261
563
|
}
|
|
262
564
|
|
|
263
565
|
export interface BooleanOperationValue<T extends number> {
|
|
264
566
|
value: T;
|
|
265
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* Enum class of available CSG operations
|
|
570
|
+
* @see MR::boolean
|
|
571
|
+
*/
|
|
266
572
|
export type BooleanOperation = BooleanOperationValue<0>|BooleanOperationValue<1>|BooleanOperationValue<2>|BooleanOperationValue<3>|BooleanOperationValue<4>|BooleanOperationValue<5>|BooleanOperationValue<6>|BooleanOperationValue<7>;
|
|
267
573
|
|
|
574
|
+
/**
|
|
575
|
+
* @brief Structure contain boolean result.
|
|
576
|
+
*
|
|
577
|
+
* Structure with parameters for boolean call.
|
|
578
|
+
*
|
|
579
|
+
* This structure store result mesh of MR::boolean or some error info
|
|
580
|
+
*/
|
|
268
581
|
export interface BooleanResult extends ClassHandle {
|
|
582
|
+
/**
|
|
583
|
+
* @brief Holds error message, empty if boolean succeed.
|
|
584
|
+
*/
|
|
269
585
|
get errorString(): string;
|
|
270
586
|
set errorString(value: EmbindString);
|
|
587
|
+
/**
|
|
588
|
+
* @brief Result mesh of boolean operation, if error occurred it would be empty.
|
|
589
|
+
*/
|
|
271
590
|
readonly mesh: Mesh | null;
|
|
591
|
+
/**
|
|
592
|
+
* @brief Returns true if boolean succeed, false otherwise.
|
|
593
|
+
*/
|
|
272
594
|
valid(): boolean;
|
|
273
595
|
}
|
|
274
596
|
|
|
275
597
|
export interface BooleanMapObjectValue<T extends number> {
|
|
276
598
|
value: T;
|
|
277
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* @brief Input object index enum.
|
|
602
|
+
*/
|
|
278
603
|
export type BooleanMapObject = BooleanMapObjectValue<0>|BooleanMapObjectValue<1>;
|
|
279
604
|
|
|
605
|
+
/**
|
|
606
|
+
* @brief Structure to map old mesh BitSets to new.
|
|
607
|
+
*
|
|
608
|
+
* Structure to easily map topology of MR::boolean input meshes to result mesh
|
|
609
|
+
*
|
|
610
|
+
* This structure allows to map faces, vertices and edges of mesh `A` and mesh `B` input of MR::boolean to result mesh topology primitives @see MR::boolean
|
|
611
|
+
*/
|
|
280
612
|
export interface BooleanResultMapper extends ClassHandle {
|
|
281
|
-
mapFaces(
|
|
282
|
-
mapVerts(
|
|
613
|
+
mapFaces(oldBS: FaceBitSet, obj: BooleanMapObject): FaceBitSet;
|
|
614
|
+
mapVerts(oldBS: VertBitSet, obj: BooleanMapObject): VertBitSet;
|
|
615
|
+
/**
|
|
616
|
+
* @brief Returns only new faces that are created during boolean operation.
|
|
617
|
+
*/
|
|
283
618
|
newFaces(): FaceBitSet;
|
|
284
|
-
|
|
285
|
-
|
|
619
|
+
/**
|
|
620
|
+
* @brief returns updated oldBS leaving only faces that has corresponding ones in result mesh
|
|
621
|
+
*/
|
|
622
|
+
filteredOldFaceBitSet(oldBS: FaceBitSet, obj: BooleanMapObject): FaceBitSet;
|
|
623
|
+
/**
|
|
624
|
+
* @brief returns map: new_face_id->old_obj_face_id for faces from
|
|
625
|
+
*
|
|
626
|
+
* @param obj
|
|
627
|
+
*/
|
|
628
|
+
getNew2OldFaceMap(obj: BooleanMapObject): FaceMap;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* @brief Building topologies by triangles.
|
|
633
|
+
*
|
|
634
|
+
* This namespace provides API for building meshes.
|
|
635
|
+
*
|
|
636
|
+
* Simple example with key steps
|
|
637
|
+
*
|
|
638
|
+
* @warning Vertices of triangles should have consistent bypass direction
|
|
639
|
+
*
|
|
640
|
+
* @note It is better to store topology directly in mesh
|
|
641
|
+
*
|
|
642
|
+
* @see MeshTopology
|
|
643
|
+
*/
|
|
644
|
+
export interface MeshBuilder extends ClassHandle {
|
|
286
645
|
}
|
|
287
646
|
|
|
288
|
-
|
|
647
|
+
type CollidingTriangleBitsets = { a: FaceBitSet; b: FaceBitSet };
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* if isEdgeATriB() == true, then stores edge from mesh A and triangle from mesh B if isEdgeATriB() == false, then stores edge from mesh B and triangle from mesh A
|
|
651
|
+
*/
|
|
652
|
+
export interface VarEdgeTri extends ClassHandle {
|
|
653
|
+
readonly edge: number;
|
|
654
|
+
tri(): number;
|
|
655
|
+
isEdgeATriB(): boolean;
|
|
289
656
|
}
|
|
290
657
|
|
|
658
|
+
/**
|
|
659
|
+
* In each VarEdgeTri = pair of (intersected edge, intersected triangle), the intersected edge is directed from negative half-space of the intersected triangle B to its positive half-space
|
|
660
|
+
*/
|
|
291
661
|
export interface PreciseCollisionResult extends ClassHandle {
|
|
662
|
+
size(): number;
|
|
663
|
+
get(i: number): VarEdgeTri;
|
|
292
664
|
}
|
|
293
665
|
|
|
666
|
+
type ComponentsMapResult = { map: Face2RegionMap; numRegions: number };
|
|
667
|
+
|
|
668
|
+
type LargeByAreaRegionsResult = { faces: FaceBitSet; numRegions: number };
|
|
669
|
+
|
|
294
670
|
export interface MeshComponentsFaceIncidenceValue<T extends number> {
|
|
295
671
|
value: T;
|
|
296
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* @brief Face incidence type.
|
|
675
|
+
*/
|
|
297
676
|
export type MeshComponentsFaceIncidence = MeshComponentsFaceIncidenceValue<0>|MeshComponentsFaceIncidenceValue<1>;
|
|
298
677
|
|
|
299
678
|
export interface MeshComponents extends ClassHandle {
|
|
@@ -302,8 +681,20 @@ export interface MeshComponents extends ClassHandle {
|
|
|
302
681
|
export interface DecimateStrategyValue<T extends number> {
|
|
303
682
|
value: T;
|
|
304
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* @brief Defines the order of edge collapses inside Decimate algorithm.
|
|
686
|
+
*/
|
|
305
687
|
export type DecimateStrategy = DecimateStrategyValue<0>|DecimateStrategyValue<1>;
|
|
306
688
|
|
|
689
|
+
/**
|
|
690
|
+
* @brief Results of MR::decimateMesh.
|
|
691
|
+
*
|
|
692
|
+
* @see decimateMesh
|
|
693
|
+
*
|
|
694
|
+
* @see decimateParallelMesh
|
|
695
|
+
*
|
|
696
|
+
* @see resolveMeshDegenerations
|
|
697
|
+
*/
|
|
307
698
|
export type DecimateResult = {
|
|
308
699
|
vertsDeleted: number,
|
|
309
700
|
facesDeleted: number,
|
|
@@ -311,53 +702,194 @@ export type DecimateResult = {
|
|
|
311
702
|
cancelled: boolean
|
|
312
703
|
};
|
|
313
704
|
|
|
705
|
+
/**
|
|
706
|
+
* @brief Parameters structure for MR::decimateMesh.
|
|
707
|
+
*
|
|
708
|
+
* @see decimateMesh
|
|
709
|
+
*/
|
|
314
710
|
export interface DecimateSettings extends ClassHandle {
|
|
315
711
|
strategy: DecimateStrategy;
|
|
712
|
+
/**
|
|
713
|
+
* for DecimateStrategy::MinimizeError: stop the decimation as soon as the estimated distance deviation from the original mesh is more than this value for DecimateStrategy::ShortestEdgeFirst only: stop the decimation as soon as the shortest edge in the mesh is greater than this value
|
|
714
|
+
*/
|
|
316
715
|
maxError: number;
|
|
716
|
+
/**
|
|
717
|
+
* @brief Maximal possible edge length created during decimation.
|
|
718
|
+
*/
|
|
317
719
|
maxEdgeLen: number;
|
|
720
|
+
/**
|
|
721
|
+
* @brief Maximal shift of a boundary during one edge collapse.
|
|
722
|
+
*/
|
|
318
723
|
maxBdShift: number;
|
|
724
|
+
/**
|
|
725
|
+
* @brief Maximal possible aspect ratio of a triangle introduced during decimation.
|
|
726
|
+
*/
|
|
319
727
|
maxTriangleAspectRatio: number;
|
|
728
|
+
/**
|
|
729
|
+
* the algorithm will ignore dihedral angle check if one of triangles had aspect ratio equal or more than this value; and the algorithm will permit temporary increase in aspect ratio after collapse, if before collapse one of the triangles had larger aspect ratio
|
|
730
|
+
*/
|
|
320
731
|
criticalTriAspectRatio: number;
|
|
732
|
+
/**
|
|
733
|
+
* @brief edges not longer than this value will be collapsed even if it results in appearance of a triangle with high aspect ratio
|
|
734
|
+
*/
|
|
321
735
|
tinyEdgeLength: number;
|
|
736
|
+
/**
|
|
737
|
+
* Small stabilizer is important to achieve good results on completely planar mesh parts, if your mesh is not-planer everywhere, then you can set it to zero
|
|
738
|
+
*/
|
|
322
739
|
stabilizer: number;
|
|
740
|
+
/**
|
|
741
|
+
* if false, then quadratic error metric is equal to the sum of distances to the planes of original mesh triangles; if true, then the sum is weighted, and the weight is equal to the angle of adjacent triangle at the vertex divided on PI (to get one after summing all 3 vertices of the triangle)
|
|
742
|
+
*/
|
|
323
743
|
angleWeightedDistToPlane: boolean;
|
|
744
|
+
/**
|
|
745
|
+
* if true then after each edge collapse the position of remaining vertex is optimized to minimize local shape change, if false then the edge is collapsed in one of its vertices, which keeps its position
|
|
746
|
+
*/
|
|
324
747
|
optimizeVertexPos: boolean;
|
|
748
|
+
/**
|
|
749
|
+
* @brief Limit on the number of deleted vertices.
|
|
750
|
+
*/
|
|
325
751
|
maxDeletedVertices: number;
|
|
752
|
+
/**
|
|
753
|
+
* @brief Limit on the number of deleted faces.
|
|
754
|
+
*/
|
|
326
755
|
maxDeletedFaces: number;
|
|
756
|
+
/**
|
|
757
|
+
* Whether to allow collapse of edges incident to notFlippable edges, which can move vertices of notFlippable edges unless they are fixed
|
|
758
|
+
*/
|
|
327
759
|
collapseNearNotFlippable: boolean;
|
|
760
|
+
/**
|
|
761
|
+
* @brief Whether to allow collapsing or flipping edges having at least one vertex on (region) boundary.
|
|
762
|
+
*/
|
|
328
763
|
touchNearBdEdges: boolean;
|
|
764
|
+
/**
|
|
765
|
+
* touchBdVerts=true: allow moving and eliminating boundary vertices during edge collapses; touchBdVerts=false: allow only collapsing an edge having only one boundary vertex in that vertex, so position and count of boundary vertices do not change; this setting is ignored if touchNearBdEdges=false
|
|
766
|
+
*/
|
|
329
767
|
touchBdVerts: boolean;
|
|
768
|
+
/**
|
|
769
|
+
* Permit edge flips (in addition to collapsing) to improve Delone quality of the mesh if it does not change dihedral angle more than on this value (negative value prohibits any edge flips)
|
|
770
|
+
*/
|
|
330
771
|
maxAngleChange: number;
|
|
772
|
+
/**
|
|
773
|
+
* @brief whether to pack mesh at the end
|
|
774
|
+
*/
|
|
331
775
|
packMesh: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* If this value is more than 1, then virtually subdivides the mesh on given number of parts to process them in parallel (using many threads); IMPORTANT: please call mesh.packOptimally() before calling decimating with subdivideParts > 1, otherwise performance will be bad
|
|
778
|
+
*/
|
|
332
779
|
subdivideParts: number;
|
|
780
|
+
/**
|
|
781
|
+
* After parallel decimation of all mesh parts is done, whether to perform final decimation of whole mesh region to eliminate small edges near the border of individual parts
|
|
782
|
+
*/
|
|
333
783
|
decimateBetweenParts: boolean;
|
|
784
|
+
/**
|
|
785
|
+
* @brief minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode
|
|
786
|
+
*/
|
|
334
787
|
minFacesInPart: number;
|
|
335
788
|
}
|
|
336
789
|
|
|
337
790
|
export interface RemeshSettings extends ClassHandle {
|
|
791
|
+
/**
|
|
792
|
+
* the algorithm will try to keep the length of all edges close to this value, splitting the edges longer than targetEdgeLen, and then eliminating the edges shorter than targetEdgeLen
|
|
793
|
+
*/
|
|
338
794
|
targetEdgeLen: number;
|
|
795
|
+
/**
|
|
796
|
+
* @brief Maximum number of edge splits allowed during subdivision.
|
|
797
|
+
*/
|
|
339
798
|
maxEdgeSplits: number;
|
|
799
|
+
/**
|
|
800
|
+
* @brief Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than on this value.
|
|
801
|
+
*/
|
|
340
802
|
maxAngleChangeAfterFlip: number;
|
|
803
|
+
/**
|
|
804
|
+
* Allows or prohibits splitting and/or collapse boundary edges it recommended to keep default value here for better quality
|
|
805
|
+
*/
|
|
341
806
|
frozenBoundary: boolean;
|
|
807
|
+
/**
|
|
808
|
+
* Maximal shift of a boundary during one edge collapse only makes sense if `frozenBoundary=false`
|
|
809
|
+
*/
|
|
342
810
|
maxBdShift: number;
|
|
811
|
+
/**
|
|
812
|
+
* This option in subdivision works best for natural surfaces, where all triangles are close to equilateral and have similar area, and no sharp edges in between
|
|
813
|
+
*/
|
|
343
814
|
useCurvature: boolean;
|
|
815
|
+
/**
|
|
816
|
+
* An edge is subdivided only if both its left and right triangles have aspect ratio below or equal to this value. So this is a maximum aspect ratio of a triangle that can be split on two before Delone optimization. Please set it to a smaller value only if frozenBoundary==true, otherwise many narrow triangles can appear near border
|
|
817
|
+
*/
|
|
344
818
|
maxSplittableTriAspectRatio: number;
|
|
819
|
+
/**
|
|
820
|
+
* the number of iterations of final relaxation of mesh vertices; few iterations can give almost perfect uniformity of the vertices and edge lengths but deviate from the original surface
|
|
821
|
+
*/
|
|
345
822
|
finalRelaxIters: number;
|
|
823
|
+
/**
|
|
824
|
+
* @brief if true prevents the surface from shrinkage after many iterations
|
|
825
|
+
*/
|
|
346
826
|
finalRelaxNoShrinkage: boolean;
|
|
827
|
+
/**
|
|
828
|
+
* @brief whether to pack mesh at the end
|
|
829
|
+
*/
|
|
347
830
|
packMesh: boolean;
|
|
831
|
+
/**
|
|
832
|
+
* if true, then every new vertex after subdivision will be projected on the original mesh (before smoothing); this does not affect the vertices moved on other stages of the processing
|
|
833
|
+
*/
|
|
348
834
|
projectOnOriginalMesh: boolean;
|
|
349
835
|
}
|
|
350
836
|
|
|
351
837
|
export interface MultipleEdgesResolveModeValue<T extends number> {
|
|
352
838
|
value: T;
|
|
353
839
|
}
|
|
840
|
+
/**
|
|
841
|
+
* If Strong makes additional efforts to avoid creating multiple edges, in some rare cases it is not possible (cases with extremely bad topology), if you faced one try to use MR::duplicateMultiHoleVertices before MR::fillHole
|
|
842
|
+
*
|
|
843
|
+
* If Simple avoid creating edges that already exist in topology (default)
|
|
844
|
+
*
|
|
845
|
+
* If None do not avoid multiple edges
|
|
846
|
+
*/
|
|
354
847
|
export type MultipleEdgesResolveMode = MultipleEdgesResolveModeValue<0>|MultipleEdgesResolveModeValue<1>|MultipleEdgesResolveModeValue<2>;
|
|
355
848
|
|
|
849
|
+
/**
|
|
850
|
+
* @brief Parameters structure for MR::fillHole
|
|
851
|
+
* Structure has some options to control MR::fillHole.
|
|
852
|
+
*
|
|
853
|
+
* @see fillHole
|
|
854
|
+
*
|
|
855
|
+
* @see FillHoleMetric
|
|
856
|
+
*/
|
|
356
857
|
export interface FillHoleParams extends ClassHandle {
|
|
858
|
+
/**
|
|
859
|
+
* If true, hole filling will minimize the sum of metrics including boundary edges, where one triangle was present before hole filling, and another is added during hole filling. This makes boundary edges same smooth as inner edges of the patch. If false, edge metric will not be applied to boundary edges, and the patch tends to make a sharper turn there.
|
|
860
|
+
*/
|
|
357
861
|
smoothBd: boolean;
|
|
358
862
|
multipleEdgesResolveMode: MultipleEdgesResolveMode;
|
|
863
|
+
/**
|
|
864
|
+
* If true creates degenerate faces band around hole to have sharp angle visualization @warning This flag bad for result topology, most likely you do not need it
|
|
865
|
+
*/
|
|
359
866
|
makeDegenerateBand: boolean;
|
|
867
|
+
/**
|
|
868
|
+
* The maximum number of polygon subdivisions on a triangle and two smaller polygons, must be 2 or larger
|
|
869
|
+
*/
|
|
360
870
|
maxPolygonSubdivisions: number;
|
|
871
|
+
/**
|
|
872
|
+
* Specifies triangulation metric
|
|
873
|
+
* default for MR::fillHole: getCircumscribedFillMetric
|
|
874
|
+
* @see FillHoleMetric
|
|
875
|
+
*/
|
|
876
|
+
metric: FillHoleMetric;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* @brief Parameters structure for MR::stitchHoles
|
|
881
|
+
* Structure has some options to control MR::stitchHoles.
|
|
882
|
+
*
|
|
883
|
+
* @see stitchHoles
|
|
884
|
+
*
|
|
885
|
+
* @see FillHoleMetric
|
|
886
|
+
*/
|
|
887
|
+
export interface StitchHolesParams extends ClassHandle {
|
|
888
|
+
/**
|
|
889
|
+
* Specifies triangulation metric
|
|
890
|
+
* default for MR::stitchHoles: getComplexStitchMetric @see FillHoleMetric
|
|
891
|
+
*/
|
|
892
|
+
metric: FillHoleMetric;
|
|
361
893
|
}
|
|
362
894
|
|
|
363
895
|
export interface FixMeshDegeneraciesModeValue<T extends number> {
|
|
@@ -366,132 +898,538 @@ export interface FixMeshDegeneraciesModeValue<T extends number> {
|
|
|
366
898
|
export type FixMeshDegeneraciesMode = FixMeshDegeneraciesModeValue<0>|FixMeshDegeneraciesModeValue<1>|FixMeshDegeneraciesModeValue<2>;
|
|
367
899
|
|
|
368
900
|
export interface FixMeshDegeneraciesParams extends ClassHandle {
|
|
901
|
+
/**
|
|
902
|
+
* @brief maximum permitted deviation from the original surface
|
|
903
|
+
*/
|
|
369
904
|
maxDeviation: number;
|
|
905
|
+
/**
|
|
906
|
+
* @brief edges not longer than this value will be collapsed ignoring normals and aspect ratio checks
|
|
907
|
+
*/
|
|
370
908
|
tinyEdgeLength: number;
|
|
909
|
+
/**
|
|
910
|
+
* the algorithm will ignore dihedral angle check if one of triangles had aspect ratio equal or more than this value; and the algorithm will permit temporary increase in aspect ratio after collapse, if before collapse one of the triangles had larger aspect ratio
|
|
911
|
+
*/
|
|
371
912
|
criticalTriAspectRatio: number;
|
|
913
|
+
/**
|
|
914
|
+
* @brief Permit edge flips if it does not change dihedral angle more than on this value.
|
|
915
|
+
*/
|
|
372
916
|
maxAngleChange: number;
|
|
917
|
+
/**
|
|
918
|
+
* Small stabilizer is important to achieve good results on completely planar mesh parts, if your mesh is not-planer everywhere, then you can set it to zero
|
|
919
|
+
*/
|
|
373
920
|
stabilizer: number;
|
|
374
921
|
mode: FixMeshDegeneraciesMode;
|
|
922
|
+
/**
|
|
923
|
+
* trying to stay close to initial surface when patching also disables smoothing on patch
|
|
924
|
+
*/
|
|
375
925
|
mimicPatch: boolean;
|
|
376
926
|
}
|
|
377
927
|
|
|
378
928
|
export interface MeshLoad extends ClassHandle {
|
|
379
929
|
}
|
|
380
930
|
|
|
931
|
+
export interface MeshMeshCollisionStatusValue<T extends number> {
|
|
932
|
+
value: T;
|
|
933
|
+
}
|
|
934
|
+
export type MeshMeshCollisionStatus = MeshMeshCollisionStatusValue<0>|MeshMeshCollisionStatusValue<1>|MeshMeshCollisionStatusValue<2>|MeshMeshCollisionStatusValue<3>|MeshMeshCollisionStatusValue<4>|MeshMeshCollisionStatusValue<5>|MeshMeshCollisionStatusValue<6>;
|
|
935
|
+
|
|
936
|
+
type MeshDistanceResult = { a: PointOnFace; b: PointOnFace; distSq: number };
|
|
937
|
+
|
|
938
|
+
type MeshMeshSignedDistanceResult = {
|
|
939
|
+
/**
|
|
940
|
+
* @brief two closest points: from meshes A and B respectively
|
|
941
|
+
*/
|
|
942
|
+
a: PointOnFace;
|
|
943
|
+
b: PointOnFace;
|
|
944
|
+
/**
|
|
945
|
+
* @brief mutual status of two meshes
|
|
946
|
+
*/
|
|
947
|
+
status: number;
|
|
948
|
+
/**
|
|
949
|
+
* @brief signed distance between a and b, positive if meshes do not collide
|
|
950
|
+
*/
|
|
951
|
+
signedDist: number;
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* @brief Holds metrics for fillHole and stitchHoles triangulation
|
|
956
|
+
* .
|
|
957
|
+
*
|
|
958
|
+
* This is struct used as optimization metric of fillHole and stitchHoles functions
|
|
959
|
+
* @see getCircumscribedMetric
|
|
960
|
+
*
|
|
961
|
+
* @see getPlaneFillMetric
|
|
962
|
+
*
|
|
963
|
+
* @see getEdgeLengthFillMetric
|
|
964
|
+
*
|
|
965
|
+
* @see getEdgeLengthStitchMetric
|
|
966
|
+
*
|
|
967
|
+
* @see getComplexStitchMetric
|
|
968
|
+
*
|
|
969
|
+
* @see fillHole
|
|
970
|
+
*
|
|
971
|
+
* @see stitchHoles
|
|
972
|
+
*/
|
|
381
973
|
export interface FillHoleMetric extends ClassHandle {
|
|
382
974
|
}
|
|
383
975
|
|
|
976
|
+
/**
|
|
977
|
+
* This class can hold either mesh part or point cloud. It is used for generic algorithms operating with either of them
|
|
978
|
+
*/
|
|
384
979
|
export interface MeshOrPoints extends ClassHandle {
|
|
385
980
|
}
|
|
386
981
|
|
|
982
|
+
/**
|
|
983
|
+
* @brief an object and its transformation to global space with other objects
|
|
984
|
+
*/
|
|
387
985
|
export interface MeshOrPointsXf extends ClassHandle {
|
|
388
986
|
xf: AffineXf3f;
|
|
389
987
|
}
|
|
390
988
|
|
|
989
|
+
type MeshProjectionResult = {
|
|
990
|
+
/**
|
|
991
|
+
* @brief the closest point on mesh, transformed by xf if it is given
|
|
992
|
+
*/
|
|
993
|
+
proj: PointOnFace;
|
|
994
|
+
/**
|
|
995
|
+
* @brief its barycentric representation
|
|
996
|
+
*/
|
|
997
|
+
mtp: MeshTriPoint;
|
|
998
|
+
/**
|
|
999
|
+
* @brief squared distance from original projected point to proj
|
|
1000
|
+
*/
|
|
1001
|
+
distSq: number;
|
|
1002
|
+
/**
|
|
1003
|
+
* @brief check for validity, otherwise the projection was not found
|
|
1004
|
+
*/
|
|
1005
|
+
valid: boolean;
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
type SignedMeshProjectionResult = { proj: PointOnFace; mtp: MeshTriPoint; dist: number } | null;
|
|
1009
|
+
|
|
391
1010
|
export interface MeshRelaxParams extends ClassHandle {
|
|
392
1011
|
iterations: number;
|
|
393
1012
|
force: number;
|
|
394
1013
|
limitNearInitial: boolean;
|
|
395
1014
|
maxInitialDist: number;
|
|
1015
|
+
/**
|
|
1016
|
+
* @brief move all region vertices with exactly three neighbor vertices in the center of the neighbors
|
|
1017
|
+
*/
|
|
396
1018
|
hardSmoothTetrahedrons: boolean;
|
|
397
1019
|
}
|
|
398
1020
|
|
|
399
1021
|
export interface MeshSave extends ClassHandle {
|
|
400
1022
|
}
|
|
401
1023
|
|
|
1024
|
+
export interface SubdivideSettings extends ClassHandle {
|
|
1025
|
+
/**
|
|
1026
|
+
* @brief Subdivision is stopped when all edges inside or on the boundary of the region are not longer than this value.
|
|
1027
|
+
*/
|
|
1028
|
+
maxEdgeLen: number;
|
|
1029
|
+
/**
|
|
1030
|
+
* edge length will be magnified by the squared difference of normals at edge's ends times this factor, thus subdivision will be finer in the regions of high curvature compared to planar regions
|
|
1031
|
+
*/
|
|
1032
|
+
curvaturePriority: number;
|
|
1033
|
+
/**
|
|
1034
|
+
* @brief Maximum number of edge splits allowed.
|
|
1035
|
+
*/
|
|
1036
|
+
maxEdgeSplits: number;
|
|
1037
|
+
/**
|
|
1038
|
+
* @brief Improves local mesh triangulation by doing edge flips if it does not make too big surface deviation.
|
|
1039
|
+
*/
|
|
1040
|
+
maxDeviationAfterFlip: number;
|
|
1041
|
+
/**
|
|
1042
|
+
* @brief Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than on this value (in radians)
|
|
1043
|
+
*/
|
|
1044
|
+
maxAngleChangeAfterFlip: number;
|
|
1045
|
+
/**
|
|
1046
|
+
* If this value is less than FLT_MAX then edge flips will ignore dihedral angle check if one of triangles has aspect ratio more than this value Unit: rad
|
|
1047
|
+
*/
|
|
1048
|
+
criticalAspectRatioFlip: number;
|
|
1049
|
+
/**
|
|
1050
|
+
* If false do not touch border edges (cannot subdivide lone faces)
|
|
1051
|
+
* use MR::findRegionOuterFaces to find boundary faces
|
|
1052
|
+
*/
|
|
1053
|
+
subdivideBorder: boolean;
|
|
1054
|
+
/**
|
|
1055
|
+
* @brief The subdivision stops as soon as all triangles (in the region) have aspect ratio below or equal to this value.
|
|
1056
|
+
*/
|
|
1057
|
+
maxTriAspectRatio: number;
|
|
1058
|
+
/**
|
|
1059
|
+
* An edge is subdivided only if both its left and right triangles have aspect ratio below or equal to this value. So this is a maximum aspect ratio of a triangle that can be split on two before Delone optimization. Please set it to a smaller value only if subdivideBorder==false, otherwise many narrow triangles can appear near border
|
|
1060
|
+
*/
|
|
1061
|
+
maxSplittableTriAspectRatio: number;
|
|
1062
|
+
/**
|
|
1063
|
+
* Puts new vertices so that they form a smooth surface together with existing vertices. This option works best for natural surfaces without sharp edges in between triangles
|
|
1064
|
+
*/
|
|
1065
|
+
smoothMode: boolean;
|
|
1066
|
+
/**
|
|
1067
|
+
* In case of activated smoothMode, the smoothness is locally deactivated at the edges having dihedral angle at least this value
|
|
1068
|
+
*/
|
|
1069
|
+
minSharpDihedralAngle: number;
|
|
1070
|
+
/**
|
|
1071
|
+
* @brief if true, then every new vertex will be projected on the original mesh (before smoothing)
|
|
1072
|
+
*/
|
|
1073
|
+
projectOnOriginalMesh: boolean;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Mesh Topology
|
|
1078
|
+
*/
|
|
402
1079
|
export interface MeshTopology extends ClassHandle {
|
|
1080
|
+
/**
|
|
1081
|
+
* @brief returns cached set of all valid vertices
|
|
1082
|
+
*/
|
|
403
1083
|
getValidVerts(): VertBitSet;
|
|
1084
|
+
/**
|
|
1085
|
+
* @brief returns cached set of all valid faces
|
|
1086
|
+
*/
|
|
404
1087
|
getValidFaces(): FaceBitSet;
|
|
1088
|
+
/**
|
|
1089
|
+
* @brief returns the number of face records including invalid ones
|
|
1090
|
+
*/
|
|
405
1091
|
faceSize(): number;
|
|
1092
|
+
/**
|
|
1093
|
+
* returns the number of hole loops in the mesh; @param holeRepresentativeEdges optional output of the smallest edge id with no valid left face in every hole
|
|
1094
|
+
*/
|
|
406
1095
|
findNumHoles(): number;
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
1096
|
+
/**
|
|
1097
|
+
* gets 3 vertices of given triangular face; the vertices are returned in counter-clockwise order if look from mesh outside
|
|
1098
|
+
*/
|
|
1099
|
+
getTriVerts(f: number): Uint32Array;
|
|
1100
|
+
/**
|
|
1101
|
+
* gets 3 vertices of the left face ( face-id may not exist, but the shape must be triangular) the vertices are returned in counter-clockwise order if look from mesh outside: v0 = org( a ), v1 = dest( a )
|
|
1102
|
+
*/
|
|
1103
|
+
getLeftTriVerts(a: number): Uint32Array;
|
|
1104
|
+
/**
|
|
1105
|
+
* returns one edge with no valid left face for every boundary in the mesh; if region is given, then returned edges must have valid right faces from the region
|
|
1106
|
+
*/
|
|
1107
|
+
findHoleRepresentiveEdges(): Uint32Array;
|
|
1108
|
+
/**
|
|
1109
|
+
* returns three vertex ids for valid triangles (which can be accessed by FaceId), vertex ids for invalid triangles are undefined, and shall not be read
|
|
1110
|
+
*/
|
|
410
1111
|
getTriangulation(): Triangulation;
|
|
411
1112
|
}
|
|
412
1113
|
|
|
1114
|
+
/**
|
|
1115
|
+
* encodes a point inside a triangular mesh face using barycentric coordinates
|
|
1116
|
+
*
|
|
1117
|
+
* Notations used below:
|
|
1118
|
+
* v0 - the value in org( e )
|
|
1119
|
+
* v1 - the value in dest( e )
|
|
1120
|
+
* v2 - the value in dest( next( e ) )
|
|
1121
|
+
*/
|
|
1122
|
+
type MeshTriPoint = {
|
|
1123
|
+
/**
|
|
1124
|
+
* left face of this edge is considered
|
|
1125
|
+
*/
|
|
1126
|
+
e: number;
|
|
1127
|
+
/**
|
|
1128
|
+
* barycentric coordinates
|
|
1129
|
+
*
|
|
1130
|
+
* a in [0,1], a=0 => point is on next( e ) edge, a=1 => point is in dest( e ) b in [0,1], b=0 => point is on e edge, b=1 => point is in dest( next( e ) ) a+b in [0,1], a+b=0 => point is in org( e ), a+b=1 => point is on prev( e.sym() ) edge
|
|
1131
|
+
*/
|
|
1132
|
+
bary: { a: number; b: number };
|
|
1133
|
+
};
|
|
1134
|
+
|
|
413
1135
|
export interface CascadeModeValue<T extends number> {
|
|
414
1136
|
value: T;
|
|
415
1137
|
}
|
|
416
1138
|
export type CascadeMode = CascadeModeValue<0>|CascadeModeValue<1>;
|
|
417
1139
|
|
|
1140
|
+
/**
|
|
1141
|
+
* @brief Parameters that are used for sampling of the MultiwayICP objects.
|
|
1142
|
+
*/
|
|
418
1143
|
export interface MultiwayICPSamplingParameters extends ClassHandle {
|
|
1144
|
+
/**
|
|
1145
|
+
* @brief sampling size of each object, 0 has special meaning "take all valid points"
|
|
1146
|
+
*/
|
|
419
1147
|
samplingVoxelSize: number;
|
|
1148
|
+
/**
|
|
1149
|
+
* size of maximum icp group to work with; if the number of objects exceeds this value, icp is applied in cascade mode; maxGroupSize = 1 means that every object is moved independently on half distance to the previous position of all other objects; maxGroupSize = 0 means that a big system of equations for all objects is solved (force no cascading)
|
|
1150
|
+
*/
|
|
420
1151
|
maxGroupSize: number;
|
|
421
1152
|
cascadeMode: CascadeMode;
|
|
422
1153
|
}
|
|
423
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* This class allows you to register many objects having similar parts and known initial approximations of orientations/locations using Iterative Closest Points (ICP) point-to-point or point-to-plane algorithms
|
|
1157
|
+
*/
|
|
424
1158
|
export interface MultiwayICP extends ClassHandle {
|
|
425
|
-
|
|
426
|
-
|
|
1159
|
+
/**
|
|
1160
|
+
* runs ICP algorithm given input objects, transformations, and parameters; @returns adjusted transformations of all objects to reach registered state the transformation of the last object is fixed and does not change here
|
|
1161
|
+
*/
|
|
1162
|
+
calculateTransformations(): AffineXf3f[];
|
|
1163
|
+
/**
|
|
1164
|
+
* @brief select pairs with origin samples on all objects
|
|
1165
|
+
*/
|
|
1166
|
+
resamplePoints(samplingParams: MultiwayICPSamplingParameters): boolean;
|
|
1167
|
+
/**
|
|
1168
|
+
* in each pair updates the target data and performs basic filtering (activation) in cascade mode only useful for stats update
|
|
1169
|
+
*/
|
|
427
1170
|
updateAllPointPairs(): boolean;
|
|
428
|
-
|
|
1171
|
+
/**
|
|
1172
|
+
* @brief tune algorithm params before run calculateTransformations()
|
|
1173
|
+
*/
|
|
1174
|
+
setParams(prop: ICPProperties): void;
|
|
429
1175
|
getParams(): ICPProperties;
|
|
1176
|
+
/**
|
|
1177
|
+
* computes root-mean-square deviation between points or the standard deviation from given value if present
|
|
1178
|
+
*/
|
|
430
1179
|
getMeanSqDistToPoint(): number;
|
|
1180
|
+
/**
|
|
1181
|
+
* computes root-mean-square deviation from points to target planes or the standard deviation from given value if present
|
|
1182
|
+
*/
|
|
431
1183
|
getMeanSqDistToPlane(): number;
|
|
1184
|
+
/**
|
|
1185
|
+
* @brief computes the number of samples able to form pairs
|
|
1186
|
+
*/
|
|
432
1187
|
getNumSamples(): number;
|
|
1188
|
+
/**
|
|
1189
|
+
* @brief computes the number of active point pairs
|
|
1190
|
+
*/
|
|
433
1191
|
getNumActivePairs(): number;
|
|
1192
|
+
/**
|
|
1193
|
+
* @brief returns status info string
|
|
1194
|
+
*/
|
|
434
1195
|
getStatusInfo(): string;
|
|
435
1196
|
}
|
|
436
1197
|
|
|
1198
|
+
export interface DenoiseViaNormalsSettings extends ClassHandle {
|
|
1199
|
+
/**
|
|
1200
|
+
* @brief use approximated computation, which is much faster than precise solution
|
|
1201
|
+
*/
|
|
1202
|
+
fastIndicatorComputation: boolean;
|
|
1203
|
+
/**
|
|
1204
|
+
* @brief 0.001 - sharp edges, 0.01 - moderate edges, 0.1 - smooth edges
|
|
1205
|
+
*/
|
|
1206
|
+
beta: number;
|
|
1207
|
+
/**
|
|
1208
|
+
* @brief the amount of smoothing: 0 - no smoothing, 1 - average smoothing, ...
|
|
1209
|
+
*/
|
|
1210
|
+
gamma: number;
|
|
1211
|
+
/**
|
|
1212
|
+
* @brief the number of iterations to smooth normals and find creases; the more the better quality, but longer computation
|
|
1213
|
+
*/
|
|
1214
|
+
normalIters: number;
|
|
1215
|
+
/**
|
|
1216
|
+
* @brief the number of iterations to update vertex coordinates from found normals; the more the better quality, but longer computation
|
|
1217
|
+
*/
|
|
1218
|
+
pointIters: number;
|
|
1219
|
+
/**
|
|
1220
|
+
* @brief how much resulting points must be attracted to initial points (e.g. to avoid general shrinkage), must be > 0
|
|
1221
|
+
*/
|
|
1222
|
+
guideWeight: number;
|
|
1223
|
+
/**
|
|
1224
|
+
* @brief if true then maximal displacement of each point during denoising will be limited
|
|
1225
|
+
*/
|
|
1226
|
+
limitNearInitial: boolean;
|
|
1227
|
+
/**
|
|
1228
|
+
* @brief maximum distance between a point and its position before relaxation, ignored if limitNearInitial = false
|
|
1229
|
+
*/
|
|
1230
|
+
maxInitialDist: number;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
437
1233
|
export interface BaseShellParameters extends ClassHandle {
|
|
1234
|
+
/**
|
|
1235
|
+
* Size of voxel in grid conversions; The user is responsible for setting some positive value here
|
|
1236
|
+
*/
|
|
438
1237
|
voxelSize: number;
|
|
439
1238
|
}
|
|
440
1239
|
|
|
441
1240
|
export interface OffsetParameters extends BaseShellParameters {
|
|
1241
|
+
/**
|
|
1242
|
+
* use FunctionVolume for voxel grid representation:
|
|
1243
|
+
* - memory consumption for voxel storage is approx. (dims.z / (2 * thread_count)) lesser
|
|
1244
|
+
* - computations are about 15% slower (because some z-layers are computed twice) this setting is ignored (as if memoryEfficient == false) if a) signDetectionMode = SignDetectionMode::OpenVDB, or b) fwn is provided (CUDA computations require full memory storage) used only by mcOffsetMesh and sharpOffsetMesh methods
|
|
1245
|
+
*/
|
|
442
1246
|
memoryEfficient: boolean;
|
|
1247
|
+
/**
|
|
1248
|
+
* determines the method to compute distance sign; offsetMesh implementing OffsetMode::Smooth supports only Unsigned, OpenVDB and HoleWindingRule here
|
|
1249
|
+
*/
|
|
443
1250
|
signDetectionMode: SignDetectionMode;
|
|
444
1251
|
}
|
|
445
1252
|
|
|
446
1253
|
export interface SharpOffsetParameters extends OffsetParameters {
|
|
1254
|
+
/**
|
|
1255
|
+
* @brief minimal surface deviation to introduce new vertex in a voxel, measured in voxelSize
|
|
1256
|
+
*/
|
|
447
1257
|
minNewVertDev: number;
|
|
1258
|
+
/**
|
|
1259
|
+
* @brief maximal surface deviation to introduce new rank 2 vertex (on intersection of 2 planes), measured in voxelSize
|
|
1260
|
+
*/
|
|
448
1261
|
maxNewRank2VertDev: number;
|
|
1262
|
+
/**
|
|
1263
|
+
* @brief maximal surface deviation to introduce new rank 3 vertex (on intersection of 3 planes), measured in voxelSize
|
|
1264
|
+
*/
|
|
449
1265
|
maxNewRank3VertDev: number;
|
|
1266
|
+
/**
|
|
1267
|
+
* correct positions of the input vertices using reference mesh by not more than this distance, measured in voxelSize; big correction can be wrong and result from self-intersections in the reference mesh
|
|
1268
|
+
*/
|
|
450
1269
|
maxOldVertPosCorrection: number;
|
|
451
1270
|
}
|
|
452
1271
|
|
|
1272
|
+
/**
|
|
1273
|
+
* @brief allows the user to select in the parameters which offset algorithm to call
|
|
1274
|
+
*/
|
|
453
1275
|
export interface GeneralOffsetParameters extends SharpOffsetParameters {
|
|
454
1276
|
mode: OffsetMode;
|
|
455
1277
|
}
|
|
456
1278
|
|
|
1279
|
+
/**
|
|
1280
|
+
* @brief Special data type for MR::cutMesh.
|
|
1281
|
+
*
|
|
1282
|
+
* This is special data for MR::cutMesh, you can convert some other contours representation to it by:
|
|
1283
|
+
* MR::convertMeshTriPointsToClosedContour MR::convertSurfacePathsToMeshContours
|
|
1284
|
+
*/
|
|
457
1285
|
export interface OneMeshContours extends ClassHandle {
|
|
458
1286
|
}
|
|
459
1287
|
|
|
460
1288
|
export interface PointCloud extends ClassHandle {
|
|
461
|
-
|
|
1289
|
+
/**
|
|
1290
|
+
* @brief only points and normals corresponding to set bits here are valid
|
|
1291
|
+
*/
|
|
1292
|
+
validPoints: VertBitSet;
|
|
1293
|
+
/**
|
|
1294
|
+
* @brief coordinates of points
|
|
1295
|
+
*/
|
|
462
1296
|
readonly points: VertCoords;
|
|
1297
|
+
/**
|
|
1298
|
+
* @brief unit normal directions of points (can be empty if no normals are known)
|
|
1299
|
+
*/
|
|
463
1300
|
readonly normals: VertCoords;
|
|
1301
|
+
/**
|
|
1302
|
+
* passes through all valid points and finds the minimal bounding box containing all of them; if toWorld transformation is given then returns minimal bounding box in world space
|
|
1303
|
+
*/
|
|
464
1304
|
computeBoundingBox(): Box3f;
|
|
465
|
-
|
|
1305
|
+
/**
|
|
1306
|
+
* @brief Invalidates caches (e.g. aabb-tree) after a change in point cloud.
|
|
1307
|
+
*/
|
|
1308
|
+
invalidateCaches(): void;
|
|
1309
|
+
/**
|
|
1310
|
+
* @brief appends a point and returns its VertId
|
|
1311
|
+
*/
|
|
1312
|
+
addPoint(point: Vector3f): number;
|
|
466
1313
|
}
|
|
467
1314
|
|
|
1315
|
+
/**
|
|
1316
|
+
* @brief Parameters of point cloud triangulation.
|
|
1317
|
+
*
|
|
1318
|
+
* @see triangulatePointCloud
|
|
1319
|
+
*/
|
|
468
1320
|
export interface TriangulationParameters extends ClassHandle {
|
|
1321
|
+
/**
|
|
1322
|
+
* @brief The number of nearest neighbor points to use for building of local triangulation.
|
|
1323
|
+
*
|
|
1324
|
+
* @note Too small value can make not optimal triangulation and additional holes
|
|
1325
|
+
* Too big value increases difficulty of optimization and decreases performance
|
|
1326
|
+
*/
|
|
469
1327
|
numNeighbours: number;
|
|
1328
|
+
/**
|
|
1329
|
+
* Radius of neighborhood around each point to consider for building local triangulation. This is an alternative to numNeighbours parameter. Please set to positive value only one of them.
|
|
1330
|
+
*/
|
|
470
1331
|
radius: number;
|
|
1332
|
+
/**
|
|
1333
|
+
* @brief Critical angle of triangles in local triangulation (angle between triangles in fan should be less then this value)
|
|
1334
|
+
*/
|
|
471
1335
|
critAngle: number;
|
|
1336
|
+
/**
|
|
1337
|
+
* @brief Critical length of hole (all holes with length less then this value will be filled)
|
|
1338
|
+
*
|
|
1339
|
+
* If value is subzero it is set automaticly to 0.7*bbox.diagonal()
|
|
1340
|
+
*/
|
|
472
1341
|
critHoleLength: number;
|
|
1342
|
+
/**
|
|
1343
|
+
* @brief automatic increase of the radius if points outside can make triangles from original radius not-Delone
|
|
1344
|
+
*/
|
|
473
1345
|
automaticRadiusIncrease: boolean;
|
|
474
1346
|
}
|
|
475
1347
|
|
|
1348
|
+
/**
|
|
1349
|
+
* @brief a point located on some mesh's face
|
|
1350
|
+
*/
|
|
1351
|
+
type PointOnFace = {
|
|
1352
|
+
/**
|
|
1353
|
+
* @brief mesh's face containing the point
|
|
1354
|
+
*/
|
|
1355
|
+
face: number;
|
|
1356
|
+
/**
|
|
1357
|
+
* @brief a point of the mesh's face
|
|
1358
|
+
*/
|
|
1359
|
+
point: Vector3f;
|
|
1360
|
+
};
|
|
1361
|
+
|
|
476
1362
|
export interface PointsLoad extends ClassHandle {
|
|
477
1363
|
}
|
|
478
1364
|
|
|
479
1365
|
export interface PointsSave extends ClassHandle {
|
|
480
1366
|
}
|
|
481
1367
|
|
|
1368
|
+
export interface PointsToMeshParameters extends ClassHandle {
|
|
1369
|
+
/**
|
|
1370
|
+
* it the distance of highest influence of a point; the maximal influence distance is 3*sigma; beyond that distance the influence is strictly zero
|
|
1371
|
+
*/
|
|
1372
|
+
sigma: number;
|
|
1373
|
+
/**
|
|
1374
|
+
* @brief minimum sum of influence weights from surrounding points for a triangle to appear, meaning that there shall be at least this number of points in close proximity
|
|
1375
|
+
*/
|
|
1376
|
+
minWeight: number;
|
|
1377
|
+
/**
|
|
1378
|
+
* coefficient used for weight calculation: e^(dist^2 * -invSigmaModifier * sigma^-2) values: (0;inf)
|
|
1379
|
+
*/
|
|
1380
|
+
invSigmaModifier: number;
|
|
1381
|
+
/**
|
|
1382
|
+
* changes the way point angle affects weight, by default it is linearly increasing with dot product if enabled - increasing as dot product^(0.5) (with respect to its sign)
|
|
1383
|
+
*/
|
|
1384
|
+
sqrtAngleWeight: boolean;
|
|
1385
|
+
/**
|
|
1386
|
+
* Size of voxel in grid conversions; The user is responsible for setting some positive value here
|
|
1387
|
+
*/
|
|
1388
|
+
voxelSize: number;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
482
1391
|
export interface MeshProjectionParameters extends ClassHandle {
|
|
1392
|
+
/**
|
|
1393
|
+
* minimum squared distance from a test point to mesh to be computed precisely, if a mesh point is found within this distance then it is immediately returned without searching for a closer one
|
|
1394
|
+
*/
|
|
483
1395
|
loDistLimitSq: number;
|
|
1396
|
+
/**
|
|
1397
|
+
* maximum squared distance from a test point to mesh to be computed precisely, if actual distance is larger than upDistLimit will be returned with not-trusted sign
|
|
1398
|
+
*/
|
|
484
1399
|
upDistLimitSq: number;
|
|
485
1400
|
}
|
|
486
1401
|
|
|
1402
|
+
/**
|
|
1403
|
+
* @brief this struct contains coordinate converters float-int-float
|
|
1404
|
+
*/
|
|
487
1405
|
export interface CoordinateConverters extends ClassHandle {
|
|
488
1406
|
}
|
|
489
1407
|
|
|
490
1408
|
export interface SignDetectionModeValue<T extends number> {
|
|
491
1409
|
value: T;
|
|
492
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* @brief how to determine the sign of distances from a mesh
|
|
1413
|
+
*/
|
|
493
1414
|
export type SignDetectionMode = SignDetectionModeValue<0>|SignDetectionModeValue<1>|SignDetectionModeValue<2>|SignDetectionModeValue<3>|SignDetectionModeValue<4>;
|
|
494
1415
|
|
|
1416
|
+
export interface UniformSamplingSettings extends ClassHandle {
|
|
1417
|
+
/**
|
|
1418
|
+
* @brief minimal distance between samples
|
|
1419
|
+
*/
|
|
1420
|
+
distance: number;
|
|
1421
|
+
/**
|
|
1422
|
+
* if point cloud has normals then automatically decreases local distance to make sure that all points inside have absolute normal dot product not less than this value; this is to make sampling denser in the regions of high curvature; value <=0 means ignore normals; value >=1 means select all points (practically useless)
|
|
1423
|
+
*/
|
|
1424
|
+
minNormalDot: number;
|
|
1425
|
+
/**
|
|
1426
|
+
* if true process the points in lexicographical order, which gives tighter and more uniform samples; if false process the points according to their ids, which is faster
|
|
1427
|
+
*/
|
|
1428
|
+
lexicographicalOrder: boolean;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
type GridMinMax = { min: number; max: number };
|
|
1432
|
+
|
|
495
1433
|
export interface MeshToVolumeTypeValue<T extends number> {
|
|
496
1434
|
value: T;
|
|
497
1435
|
}
|
|
@@ -504,12 +1442,30 @@ export interface MeshToVolumeParams extends ClassHandle {
|
|
|
504
1442
|
voxelSize: Vector3f;
|
|
505
1443
|
}
|
|
506
1444
|
|
|
1445
|
+
/**
|
|
1446
|
+
* @brief parameters of OpenVDB Grid to Mesh conversion using Dual Marching Cubes algorithm
|
|
1447
|
+
*/
|
|
507
1448
|
export interface GridToMeshSettings extends ClassHandle {
|
|
1449
|
+
/**
|
|
1450
|
+
* @brief layer of grid with this value would be converted in mesh; isoValue can be negative only in level set grids
|
|
1451
|
+
*/
|
|
508
1452
|
isoValue: number;
|
|
1453
|
+
/**
|
|
1454
|
+
* @brief adaptivity - [0.0;1.0] ratio of combining small triangles into bigger ones (curvature can be lost on high values)
|
|
1455
|
+
*/
|
|
509
1456
|
adaptivity: number;
|
|
1457
|
+
/**
|
|
1458
|
+
* @brief if the mesh exceeds this number of faces, an error returns
|
|
1459
|
+
*/
|
|
510
1460
|
maxFaces: number;
|
|
1461
|
+
/**
|
|
1462
|
+
* @brief if the mesh exceeds this number of vertices, an error returns
|
|
1463
|
+
*/
|
|
511
1464
|
maxVertices: number;
|
|
512
1465
|
relaxDisorientedTriangles: boolean;
|
|
1466
|
+
/**
|
|
1467
|
+
* @brief the size of each voxel in the grid
|
|
1468
|
+
*/
|
|
513
1469
|
voxelSize: Vector3f;
|
|
514
1470
|
}
|
|
515
1471
|
|
|
@@ -522,31 +1478,38 @@ export interface VdbVolume extends ClassHandle {
|
|
|
522
1478
|
}
|
|
523
1479
|
|
|
524
1480
|
export interface VertCoords extends ClassHandle {
|
|
525
|
-
toArray():
|
|
1481
|
+
toArray(): Float32Array;
|
|
1482
|
+
size(): number;
|
|
1483
|
+
get(i: number): Vector3f;
|
|
1484
|
+
set(i: number, p: Vector3f): void;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
export interface VertScalars extends ClassHandle {
|
|
1488
|
+
toArray(): Float32Array;
|
|
526
1489
|
}
|
|
527
1490
|
|
|
528
1491
|
export interface Triangulation extends ClassHandle {
|
|
529
|
-
toArray():
|
|
1492
|
+
toArray(): Uint32Array;
|
|
530
1493
|
}
|
|
531
1494
|
|
|
532
1495
|
export interface FaceNormals extends ClassHandle {
|
|
533
|
-
toArray():
|
|
1496
|
+
toArray(): Float32Array;
|
|
534
1497
|
}
|
|
535
1498
|
|
|
536
1499
|
export interface VertMap extends ClassHandle {
|
|
537
|
-
toArray():
|
|
1500
|
+
toArray(): Uint32Array;
|
|
538
1501
|
}
|
|
539
1502
|
|
|
540
1503
|
export interface FaceMap extends ClassHandle {
|
|
541
|
-
toArray():
|
|
1504
|
+
toArray(): Uint32Array;
|
|
542
1505
|
}
|
|
543
1506
|
|
|
544
1507
|
export interface Face2RegionMap extends ClassHandle {
|
|
545
|
-
toArray():
|
|
1508
|
+
toArray(): Uint32Array;
|
|
546
1509
|
}
|
|
547
1510
|
|
|
548
1511
|
export interface VertColors extends ClassHandle {
|
|
549
|
-
toArray():
|
|
1512
|
+
toArray(): Uint8Array;
|
|
550
1513
|
}
|
|
551
1514
|
|
|
552
1515
|
export type Vector3f = {
|
|
@@ -561,13 +1524,47 @@ export type Vector3i = {
|
|
|
561
1524
|
z: number
|
|
562
1525
|
};
|
|
563
1526
|
|
|
1527
|
+
/**
|
|
1528
|
+
* three-dimensional vector
|
|
1529
|
+
*/
|
|
1530
|
+
export interface Vector3 extends ClassHandle {
|
|
1531
|
+
}
|
|
1532
|
+
|
|
564
1533
|
export interface VoxelsLoad extends ClassHandle {
|
|
565
1534
|
}
|
|
566
1535
|
|
|
567
1536
|
export interface VoxelsSave extends ClassHandle {
|
|
568
1537
|
}
|
|
569
1538
|
|
|
1539
|
+
export interface WeightedShellParametersBase extends ClassHandle {
|
|
1540
|
+
/**
|
|
1541
|
+
* @brief build iso-surface of minimal distance to points corresponding to this value
|
|
1542
|
+
*/
|
|
1543
|
+
offset: number;
|
|
1544
|
+
/**
|
|
1545
|
+
* Size of voxel in grid conversions; The user is responsible for setting some positive value here
|
|
1546
|
+
*/
|
|
1547
|
+
voxelSize: number;
|
|
1548
|
+
/**
|
|
1549
|
+
* @brief number of voxels to compute near the offset (should be left default unless used for debugging)
|
|
1550
|
+
*/
|
|
1551
|
+
numLayers: number;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
export interface WeightedShellParametersMetric extends WeightedShellParametersBase {
|
|
1555
|
+
/**
|
|
1556
|
+
* @brief parameters of distance finding
|
|
1557
|
+
*/
|
|
1558
|
+
dist: DistanceFromWeightedPointsParams;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
export interface WeightedShell extends ClassHandle {
|
|
1562
|
+
}
|
|
1563
|
+
|
|
570
1564
|
interface EmbindModule {
|
|
1565
|
+
NoiseSettings: {
|
|
1566
|
+
new(): NoiseSettings;
|
|
1567
|
+
};
|
|
571
1568
|
AffineXf3f: {
|
|
572
1569
|
new(): AffineXf3f;
|
|
573
1570
|
new(_0: Matrix3f, _1: Vector3f): AffineXf3f;
|
|
@@ -576,23 +1573,23 @@ interface EmbindModule {
|
|
|
576
1573
|
};
|
|
577
1574
|
BitSet: {
|
|
578
1575
|
new(): BitSet;
|
|
579
|
-
fromIndices(
|
|
1576
|
+
fromIndices(indices: readonly number[] | Uint32Array): BitSet;
|
|
580
1577
|
};
|
|
581
1578
|
FaceBitSet: {
|
|
582
1579
|
new(): FaceBitSet;
|
|
583
|
-
fromIndices(
|
|
1580
|
+
fromIndices(indices: readonly number[] | Uint32Array): FaceBitSet;
|
|
584
1581
|
};
|
|
585
1582
|
VertBitSet: {
|
|
586
1583
|
new(): VertBitSet;
|
|
587
|
-
fromIndices(
|
|
1584
|
+
fromIndices(indices: readonly number[] | Uint32Array): VertBitSet;
|
|
588
1585
|
};
|
|
589
1586
|
EdgeBitSet: {
|
|
590
1587
|
new(): EdgeBitSet;
|
|
591
|
-
fromIndices(
|
|
1588
|
+
fromIndices(indices: readonly number[] | Uint32Array): EdgeBitSet;
|
|
592
1589
|
};
|
|
593
1590
|
UndirectedEdgeBitSet: {
|
|
594
1591
|
new(): UndirectedEdgeBitSet;
|
|
595
|
-
fromIndices(
|
|
1592
|
+
fromIndices(indices: readonly number[] | Uint32Array): UndirectedEdgeBitSet;
|
|
596
1593
|
};
|
|
597
1594
|
Box3f: {
|
|
598
1595
|
new(): Box3f;
|
|
@@ -602,7 +1599,18 @@ interface EmbindModule {
|
|
|
602
1599
|
new(): Box3i;
|
|
603
1600
|
new(_0: Vector3i, _1: Vector3i): Box3i;
|
|
604
1601
|
};
|
|
1602
|
+
DistanceFromWeightedPointsParams: {
|
|
1603
|
+
new(): DistanceFromWeightedPointsParams;
|
|
1604
|
+
};
|
|
1605
|
+
/**
|
|
1606
|
+
* Caller can avoid filling non-needed part of cut faces to speedup cutting still add pseudo FaceId to opposite side to keep connectivity
|
|
1607
|
+
*/
|
|
605
1608
|
FillPart: {Both: FillPartValue<0>, Left: FillPartValue<1>, Right: FillPartValue<2>};
|
|
1609
|
+
/**
|
|
1610
|
+
* This enum defines the MR::cutMesh behaviour in case of bad faces acure basicaly MR::cutMesh removes all faces which contours pass through, adds new edges to topology and fills all removed parts
|
|
1611
|
+
*
|
|
1612
|
+
* @note Bad faces here mean faces where contours have intersections and cannot be cut and filled in an good way
|
|
1613
|
+
*/
|
|
606
1614
|
ForceFill: {None: ForceFillValue<0>, Good: ForceFillValue<1>, All: ForceFillValue<2>};
|
|
607
1615
|
CutMeshParameters: {
|
|
608
1616
|
new(): CutMeshParameters;
|
|
@@ -610,7 +1618,13 @@ interface EmbindModule {
|
|
|
610
1618
|
CutByProjectionSettings: {
|
|
611
1619
|
new(): CutByProjectionSettings;
|
|
612
1620
|
};
|
|
1621
|
+
/**
|
|
1622
|
+
* @brief determines the weight of each edge in applications like Laplacian
|
|
1623
|
+
*/
|
|
613
1624
|
EdgeWeights: {Unit: EdgeWeightsValue<0>, Cotan: EdgeWeightsValue<1>};
|
|
1625
|
+
/**
|
|
1626
|
+
* @brief determines the weight or mass of each vertex in applications like Laplacian
|
|
1627
|
+
*/
|
|
614
1628
|
VertexMass: {Unit: VertexMassValue<0>, NeiArea: VertexMassValue<1>};
|
|
615
1629
|
RememberShape: {Yes: RememberShapeValue<0>, No: RememberShapeValue<1>};
|
|
616
1630
|
OffsetMode: {Smooth: OffsetModeValue<0>, Standard: OffsetModeValue<1>, Sharpening: OffsetModeValue<2>};
|
|
@@ -623,144 +1637,481 @@ interface EmbindModule {
|
|
|
623
1637
|
FillHoleNicelySettings: {
|
|
624
1638
|
new(): FillHoleNicelySettings;
|
|
625
1639
|
};
|
|
1640
|
+
/**
|
|
1641
|
+
* @brief Fix method.
|
|
1642
|
+
*/
|
|
626
1643
|
SelfIntersectionsMethod: {Relax: SelfIntersectionsMethodValue<0>, CutAndFill: SelfIntersectionsMethodValue<1>};
|
|
627
1644
|
SelfIntersectionsSettings: {
|
|
628
1645
|
new(): SelfIntersectionsSettings;
|
|
629
1646
|
};
|
|
630
1647
|
SelfIntersections: {
|
|
631
|
-
|
|
632
|
-
|
|
1648
|
+
/**
|
|
1649
|
+
* @brief Find all self-intersections faces component-wise.
|
|
1650
|
+
*/
|
|
1651
|
+
getFaces(mesh: Mesh, touchIsIntersection: boolean): FaceBitSet;
|
|
1652
|
+
/**
|
|
1653
|
+
* @brief Finds and fixes self-intersections per component:
|
|
1654
|
+
*/
|
|
1655
|
+
fix(mesh: Mesh, settings: SelfIntersectionsSettings): void;
|
|
633
1656
|
};
|
|
634
1657
|
FloatGrid: {
|
|
635
1658
|
new(): FloatGrid;
|
|
636
1659
|
};
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
1660
|
+
/**
|
|
1661
|
+
* @brief resample this grid to fit voxelScale
|
|
1662
|
+
*/
|
|
1663
|
+
resampled(grid: FloatGrid, voxelScale: number): FloatGrid;
|
|
1664
|
+
/**
|
|
1665
|
+
* @brief resample this grid to fit voxelScale
|
|
1666
|
+
*/
|
|
1667
|
+
resampled(grid: FloatGrid, scaleX: number, scaleY: number, scaleZ: number): FloatGrid;
|
|
1668
|
+
/**
|
|
1669
|
+
* @brief returns cropped grid
|
|
1670
|
+
*/
|
|
1671
|
+
cropped(grid: FloatGrid, box: Box3i): FloatGrid;
|
|
640
1672
|
FreeFormDeformer: {
|
|
641
|
-
new(
|
|
1673
|
+
new(mesh: Mesh | null): FreeFormDeformer;
|
|
642
1674
|
};
|
|
1675
|
+
/**
|
|
1676
|
+
* @brief The method how to update transformation from point pairs.
|
|
1677
|
+
*/
|
|
643
1678
|
ICPMethod: {Combined: ICPMethodValue<0>, PointToPoint: ICPMethodValue<1>, PointToPlane: ICPMethodValue<2>};
|
|
1679
|
+
/**
|
|
1680
|
+
* @brief The group of transformations, each with its own degrees of freedom.
|
|
1681
|
+
*/
|
|
644
1682
|
ICPMode: {RigidScale: ICPModeValue<0>, AnyRigidXf: ICPModeValue<1>, OrthogonalAxis: ICPModeValue<2>, FixedAxis: ICPModeValue<3>, TranslationOnly: ICPModeValue<4>};
|
|
645
1683
|
ICPExitType: {NotStarted: ICPExitTypeValue<0>, NotFoundSolution: ICPExitTypeValue<1>, MaxIterations: ICPExitTypeValue<2>, MaxBadIterations: ICPExitTypeValue<3>, StopMsdReached: ICPExitTypeValue<4>};
|
|
646
1684
|
ICPProperties: {
|
|
647
1685
|
new(): ICPProperties;
|
|
648
1686
|
};
|
|
649
1687
|
ICP: {
|
|
650
|
-
new(
|
|
651
|
-
new(
|
|
1688
|
+
new(flt: MeshOrPointsXf, ref: MeshOrPointsXf, samplingVoxelSize: number): ICP;
|
|
1689
|
+
new(flt: MeshOrPointsXf, ref: MeshOrPointsXf, fltSamples: VertBitSet, refSamples: VertBitSet): ICP;
|
|
652
1690
|
};
|
|
653
1691
|
ContinuousContours: {};
|
|
654
1692
|
Laplacian: {
|
|
655
|
-
new(
|
|
1693
|
+
new(mesh: Mesh | null): Laplacian;
|
|
656
1694
|
};
|
|
657
1695
|
Matrix3f: {
|
|
658
1696
|
new(): Matrix3f;
|
|
659
1697
|
new(_0: Vector3f, _1: Vector3f, _2: Vector3f): Matrix3f;
|
|
660
1698
|
identity(): Matrix3f;
|
|
661
1699
|
zero(): Matrix3f;
|
|
662
|
-
rotation(
|
|
1700
|
+
rotation(axis: Vector3f, angle: number): Matrix3f;
|
|
663
1701
|
};
|
|
664
1702
|
Mesh: {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
1703
|
+
/**
|
|
1704
|
+
* @brief construct mesh from vertex coordinates and a set of triangles with given ids
|
|
1705
|
+
*/
|
|
1706
|
+
fromTriangles(vertexCoordinates: VertCoords, t: Triangulation): Mesh | null;
|
|
1707
|
+
/**
|
|
1708
|
+
* construct mesh from vertex coordinates and a set of triangles with given ids; unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices; `betterCont` (if given) selects the best triangle among several possible continuations during the duplication
|
|
1709
|
+
*/
|
|
1710
|
+
fromTrianglesDuplicatingNonManifoldVertices(vertexCoordinates: VertCoords, t: Triangulation): Mesh | null;
|
|
1711
|
+
};
|
|
1712
|
+
addNoise(mesh: Mesh | null, settings: NoiseSettings): void;
|
|
1713
|
+
/**
|
|
1714
|
+
* @brief Performs orthographic projection with of given contours to mesh and cut result lines, fails if any point of contours has missed mesh on projection stage or cut contours contains self-intersections
|
|
1715
|
+
*
|
|
1716
|
+
* @note it might be useful to subdivide mesh before cut, to avoid issues related to lone contours
|
|
1717
|
+
*
|
|
1718
|
+
* @param mesh for cutting, it will be changed
|
|
1719
|
+
* @param contours for projection onto mesh
|
|
1720
|
+
* @param settings to specify direction and `contours` to `mesh` space transformation
|
|
1721
|
+
*
|
|
1722
|
+
* @returns newly appeared edges on the mesh after cut or error
|
|
1723
|
+
*/
|
|
1724
|
+
cutMeshByProjection(mesh: Mesh | null, contours: readonly Float32Array[], settings: CutByProjectionSettings): Uint32Array[];
|
|
1725
|
+
makeConvexHullFromMesh(mesh: Mesh | null): Mesh | null;
|
|
1726
|
+
/**
|
|
1727
|
+
* creates box mesh with given min-corner (base) and given size in every dimension; with default parameters, creates unit cube mesh with the centroid in (0,0,0)
|
|
1728
|
+
*/
|
|
1729
|
+
makeCube(): Mesh | null;
|
|
1730
|
+
makeCylinderAdvanced(radius0: number, radius1: number, start_angle: number, arc_size: number, length: number, resolution: number): Mesh | null;
|
|
1731
|
+
/**
|
|
1732
|
+
* fills a hole in mesh specified by one of its edge, optionally subdivides new patch on smaller triangles, optionally make smooth connection with existing triangles outside the hole @returns triangles of the patch
|
|
1733
|
+
*/
|
|
1734
|
+
fillHoleNicely(mesh: Mesh | null, holeEdge: number, settings: FillHoleNicelySettings): FaceBitSet;
|
|
1735
|
+
/**
|
|
1736
|
+
* @brief creates a mesh of sphere with irregular triangulation
|
|
1737
|
+
*/
|
|
1738
|
+
makeSphere(params: SphereParams): Mesh | null;
|
|
1739
|
+
/**
|
|
1740
|
+
* @brief creates a mesh of sphere with regular triangulation (parallels and meridians)
|
|
1741
|
+
*/
|
|
1742
|
+
makeUVSphere(radius: number, horisontalResolution: number, verticalResolution: number): Mesh | null;
|
|
1743
|
+
/**
|
|
1744
|
+
* Enum class of available CSG operations
|
|
1745
|
+
* @see MR::boolean
|
|
1746
|
+
*/
|
|
674
1747
|
BooleanOperation: {InsideA: BooleanOperationValue<0>, InsideB: BooleanOperationValue<1>, OutsideA: BooleanOperationValue<2>, OutsideB: BooleanOperationValue<3>, Union: BooleanOperationValue<4>, Intersection: BooleanOperationValue<5>, DifferenceBA: BooleanOperationValue<6>, DifferenceAB: BooleanOperationValue<7>};
|
|
675
1748
|
BooleanResult: {};
|
|
676
|
-
|
|
1749
|
+
/**
|
|
1750
|
+
* @brief Performs CSG operation on two meshes.
|
|
1751
|
+
*
|
|
1752
|
+
* Makes new mesh - result of boolean operation on mesh `A` and mesh `B` @param meshA Input mesh `A`
|
|
1753
|
+
* @param meshB Input mesh `B`
|
|
1754
|
+
* @param operation CSG operation to perform
|
|
1755
|
+
* @param rigidB2A Transform from mesh `B` space to mesh `A` space
|
|
1756
|
+
* @param mapper Optional output structure to map mesh `A` and mesh `B` topology to result mesh topology
|
|
1757
|
+
*
|
|
1758
|
+
* @note Input meshes should have no self-intersections in intersecting zone
|
|
1759
|
+
*
|
|
1760
|
+
* @note If meshes are not closed in intersecting zone some boolean operations are not allowed (as far as input meshes interior and exterior cannot be determined)
|
|
1761
|
+
*/
|
|
1762
|
+
boolean(meshA: Mesh | null, meshB: Mesh | null, operation: BooleanOperation): BooleanResult;
|
|
1763
|
+
/**
|
|
1764
|
+
* @brief Input object index enum.
|
|
1765
|
+
*/
|
|
677
1766
|
BooleanMapObject: {A: BooleanMapObjectValue<0>, B: BooleanMapObjectValue<1>};
|
|
678
1767
|
BooleanResultMapper: {
|
|
679
1768
|
new(): BooleanResultMapper;
|
|
680
1769
|
};
|
|
681
|
-
|
|
1770
|
+
/**
|
|
1771
|
+
* @brief Performs CSG operation on two meshes.
|
|
1772
|
+
*
|
|
1773
|
+
* Makes new mesh - result of boolean operation on mesh `A` and mesh `B` @param meshA Input mesh `A`
|
|
1774
|
+
* @param meshB Input mesh `B`
|
|
1775
|
+
* @param operation CSG operation to perform
|
|
1776
|
+
* @param rigidB2A Transform from mesh `B` space to mesh `A` space
|
|
1777
|
+
* @param mapper Optional output structure to map mesh `A` and mesh `B` topology to result mesh topology
|
|
1778
|
+
*
|
|
1779
|
+
* @note Input meshes should have no self-intersections in intersecting zone
|
|
1780
|
+
*
|
|
1781
|
+
* @note If meshes are not closed in intersecting zone some boolean operations are not allowed (as far as input meshes interior and exterior cannot be determined)
|
|
1782
|
+
*/
|
|
1783
|
+
boolean(meshA: Mesh | null, meshB: Mesh | null, operation: BooleanOperation, mapper: BooleanResultMapper): BooleanResult;
|
|
682
1784
|
MeshBuilder: {
|
|
683
|
-
|
|
1785
|
+
/**
|
|
1786
|
+
* the function finds groups of mesh vertices located closer to each other than@param closeDist and unites such vertices in one; then the mesh is rebuilt from the remaining triangles
|
|
1787
|
+
* @param optionalVertOldToNew is the mapping of vertices: before -> after
|
|
1788
|
+
* @param uniteOnlyBd if true then only boundary vertices can be united, all internal vertices (even close ones) will remain
|
|
1789
|
+
*
|
|
1790
|
+
* @returns the number of vertices united, 0 means no change in the mesh
|
|
1791
|
+
*/
|
|
1792
|
+
uniteCloseVertices(mesh: Mesh | null, closeDist: number, uniteOnlyBd: boolean): number;
|
|
684
1793
|
};
|
|
685
|
-
|
|
1794
|
+
/**
|
|
1795
|
+
* @brief checks that arbitrary mesh part A is inside of closed mesh part B
|
|
1796
|
+
*
|
|
1797
|
+
* @param rigidB2A rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
|
|
1798
|
+
*/
|
|
1799
|
+
isInside(a: Mesh | null, b: Mesh | null): boolean;
|
|
1800
|
+
/**
|
|
1801
|
+
* @brief finds all pairs of colliding triangles from two meshes or two mesh regions
|
|
1802
|
+
*
|
|
1803
|
+
* @param rigidB2A rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
|
|
1804
|
+
* @param firstIntersectionOnly if true then the function returns at most one pair of intersecting triangles and returns faster
|
|
1805
|
+
*/
|
|
1806
|
+
findCollidingTriangles(a: Mesh | null, b: Mesh | null): FaceFace[];
|
|
1807
|
+
/**
|
|
1808
|
+
* @brief finds all pairs of colliding triangles from two meshes or two mesh regions
|
|
1809
|
+
*
|
|
1810
|
+
* @param rigidB2A rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
|
|
1811
|
+
* @param firstIntersectionOnly if true then the function returns at most one pair of intersecting triangles and returns faster
|
|
1812
|
+
*/
|
|
1813
|
+
findCollidingTriangles(a: Mesh | null, b: Mesh | null, firstIntersectionOnly: boolean): FaceFace[];
|
|
1814
|
+
/**
|
|
1815
|
+
* @brief the same as findCollidingTriangles, but returns one bite set per mesh with colliding triangles
|
|
1816
|
+
*/
|
|
1817
|
+
findCollidingTriangleBitsets(a: Mesh | null, b: Mesh | null): CollidingTriangleBitsets;
|
|
1818
|
+
/**
|
|
1819
|
+
* @brief finds all pairs (or the fact of any self-collision) of colliding triangles from one mesh or a region
|
|
1820
|
+
*
|
|
1821
|
+
* if true then treat touching faces as self-intersections too
|
|
1822
|
+
*/
|
|
1823
|
+
findSelfCollidingTriangles(mp: Mesh | null): FaceFace[];
|
|
1824
|
+
/**
|
|
1825
|
+
* @brief the same findSelfCollidingTriangles but returns the union of all self-intersecting faces
|
|
1826
|
+
*
|
|
1827
|
+
* if true then treat touching faces as self-intersections too
|
|
1828
|
+
*/
|
|
1829
|
+
findSelfCollidingTrianglesBS(mp: Mesh | null): FaceBitSet;
|
|
1830
|
+
VarEdgeTri: {};
|
|
686
1831
|
PreciseCollisionResult: {};
|
|
1832
|
+
/**
|
|
1833
|
+
* @brief Face incidence type.
|
|
1834
|
+
*/
|
|
687
1835
|
MeshComponentsFaceIncidence: {PerEdge: MeshComponentsFaceIncidenceValue<0>, PerVertex: MeshComponentsFaceIncidenceValue<1>};
|
|
688
1836
|
MeshComponents: {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
1837
|
+
/**
|
|
1838
|
+
* returns one connected component containing given face, not effective to call more than once, if several components are needed use getAllComponents
|
|
1839
|
+
*/
|
|
1840
|
+
getComponent(meshPart: Mesh | null, id: number, incidence: MeshComponentsFaceIncidence): FaceBitSet;
|
|
1841
|
+
/**
|
|
1842
|
+
* @brief returns union of connected components, each of which contains at least one seed face
|
|
1843
|
+
*/
|
|
1844
|
+
getComponents(meshPart: Mesh | null, seeds: FaceBitSet, incidence: MeshComponentsFaceIncidence): FaceBitSet;
|
|
1845
|
+
/**
|
|
1846
|
+
* @brief returns the largest by surface area component or empty set if its area is smaller than
|
|
1847
|
+
*
|
|
1848
|
+
* @param minArea optional output: the number of components in addition to returned one
|
|
1849
|
+
*/
|
|
1850
|
+
getLargestComponent(meshPart: Mesh | null, incidence: MeshComponentsFaceIncidence, minArea: number): FaceBitSet;
|
|
1851
|
+
/**
|
|
1852
|
+
* @brief returns the union of connected components, each having at least given area
|
|
1853
|
+
*/
|
|
1854
|
+
getLargeByAreaComponents(mp: Mesh | null, minArea: number): FaceBitSet;
|
|
1855
|
+
/**
|
|
1856
|
+
* @brief returns the number of connected components in mesh part
|
|
1857
|
+
*/
|
|
1858
|
+
getNumComponents(meshPart: Mesh | null, incidence: MeshComponentsFaceIncidence): number;
|
|
1859
|
+
/**
|
|
1860
|
+
* gets all connected components of mesh part @detail if components number more than the maxComponentCount, they will be combined into groups of the same size @param maxComponentCount should be more than 1
|
|
1861
|
+
*
|
|
1862
|
+
* @returns pair components bitsets vector and number components in one group if components number more than maxComponentCount
|
|
1863
|
+
*/
|
|
1864
|
+
getAllComponents(meshPart: Mesh | null, incidence: MeshComponentsFaceIncidence): FaceBitSet[];
|
|
1865
|
+
/**
|
|
1866
|
+
* gets all connected components of mesh part as
|
|
1867
|
+
* 1. the mapping: FaceId -> Component ID in [0, 1, 2, ...)
|
|
1868
|
+
* 2. the total number of components
|
|
1869
|
+
*/
|
|
1870
|
+
getAllComponentsMap(meshPart: Mesh | null, incidence: MeshComponentsFaceIncidence): ComponentsMapResult;
|
|
1871
|
+
/**
|
|
1872
|
+
* returns
|
|
1873
|
+
* 1. the union of all regions with area >= minArea
|
|
1874
|
+
* 2. the number of such regions
|
|
1875
|
+
*/
|
|
1876
|
+
getLargeByAreaRegions(meshPart: Mesh | null, regionMap: Face2RegionMap, numRegions: number, minArea: number): LargeByAreaRegionsResult;
|
|
697
1877
|
};
|
|
1878
|
+
/**
|
|
1879
|
+
* @brief Defines the order of edge collapses inside Decimate algorithm.
|
|
1880
|
+
*/
|
|
698
1881
|
DecimateStrategy: {MinimizeError: DecimateStrategyValue<0>, ShortestEdgeFirst: DecimateStrategyValue<1>};
|
|
699
1882
|
DecimateSettings: {
|
|
700
1883
|
new(): DecimateSettings;
|
|
701
1884
|
};
|
|
702
|
-
|
|
1885
|
+
/**
|
|
1886
|
+
* @brief Performs mesh simplification in mesh region according to the settings.
|
|
1887
|
+
*/
|
|
1888
|
+
decimateMesh(mesh: Mesh | null, settings: DecimateSettings): DecimateResult;
|
|
703
1889
|
RemeshSettings: {
|
|
704
1890
|
new(): RemeshSettings;
|
|
705
1891
|
};
|
|
706
|
-
|
|
1892
|
+
/**
|
|
1893
|
+
* @brief Splits too long and eliminates too short edges from the mesh.
|
|
1894
|
+
*/
|
|
1895
|
+
remesh(mesh: Mesh | null, settings: RemeshSettings): boolean;
|
|
1896
|
+
/**
|
|
1897
|
+
* @brief Create a band of degenerate faces along the border of the specified region and the rest of the mesh.
|
|
1898
|
+
*
|
|
1899
|
+
* The function is useful for extruding the region without changing the existing faces and creating holes
|
|
1900
|
+
*
|
|
1901
|
+
* @param mesh - the target mesh
|
|
1902
|
+
* @param region - the region required to be separated by a band of degenerate faces
|
|
1903
|
+
* @param params - optional output parameters
|
|
1904
|
+
*/
|
|
1905
|
+
makeDegenerateBandAroundRegion(mesh: Mesh | null, region: FaceBitSet): void;
|
|
1906
|
+
/**
|
|
1907
|
+
* If Strong makes additional efforts to avoid creating multiple edges, in some rare cases it is not possible (cases with extremely bad topology), if you faced one try to use MR::duplicateMultiHoleVertices before MR::fillHole
|
|
1908
|
+
*
|
|
1909
|
+
* If Simple avoid creating edges that already exist in topology (default)
|
|
1910
|
+
*
|
|
1911
|
+
* If None do not avoid multiple edges
|
|
1912
|
+
*/
|
|
707
1913
|
MultipleEdgesResolveMode: {None: MultipleEdgesResolveModeValue<0>, Simple: MultipleEdgesResolveModeValue<1>, Strong: MultipleEdgesResolveModeValue<2>};
|
|
708
1914
|
FillHoleParams: {
|
|
709
1915
|
new(): FillHoleParams;
|
|
710
1916
|
};
|
|
711
|
-
|
|
712
|
-
|
|
1917
|
+
StitchHolesParams: {
|
|
1918
|
+
new(): StitchHolesParams;
|
|
1919
|
+
};
|
|
1920
|
+
/**
|
|
1921
|
+
* @brief Fills hole in mesh
|
|
1922
|
+
* .
|
|
1923
|
+
*
|
|
1924
|
+
* Fills given hole represented by one of its edges (having no valid left face),
|
|
1925
|
+
* uses fillHoleTrivially if cannot fill hole without multiple edges,
|
|
1926
|
+
* default metric: CircumscribedFillMetric
|
|
1927
|
+
*
|
|
1928
|
+
* Next picture show, how newly generated faces can be smoothed MR::positionVertsSmoothly MR::subdivideMesh
|
|
1929
|
+
*
|
|
1930
|
+
* @param mesh mesh with hole
|
|
1931
|
+
* @param a EdgeId which represents hole (should not have valid left FaceId)
|
|
1932
|
+
* @param params parameters of hole filling
|
|
1933
|
+
*
|
|
1934
|
+
* @see stitchHoles
|
|
1935
|
+
*
|
|
1936
|
+
* @see fillHoleTrivially
|
|
1937
|
+
*
|
|
1938
|
+
* @see FillHoleParams
|
|
1939
|
+
*/
|
|
1940
|
+
fillHole(mesh: Mesh | null, a: number, params: FillHoleParams): void;
|
|
1941
|
+
/**
|
|
1942
|
+
* @brief fill all holes given by their representative edges in
|
|
1943
|
+
*
|
|
1944
|
+
* @param as
|
|
1945
|
+
*/
|
|
1946
|
+
fillHoles(mesh: Mesh | null, as: readonly number[] | Uint32Array, params: FillHoleParams): void;
|
|
1947
|
+
/**
|
|
1948
|
+
* @brief Stitches two holes in Mesh
|
|
1949
|
+
* .
|
|
1950
|
+
*
|
|
1951
|
+
* Build cylindrical patch to fill space between two holes represented by one of their edges each,
|
|
1952
|
+
* default metric: ComplexStitchMetric
|
|
1953
|
+
*
|
|
1954
|
+
* Next picture show, how newly generated faces can be smoothed MR::positionVertsSmoothly MR::subdivideMesh
|
|
1955
|
+
*
|
|
1956
|
+
* @param mesh mesh with hole
|
|
1957
|
+
* @param a EdgeId which represents 1st hole (should not have valid left FaceId)
|
|
1958
|
+
* @param b EdgeId which represents 2nd hole (should not have valid left FaceId)
|
|
1959
|
+
* @param params parameters of holes stitching
|
|
1960
|
+
*
|
|
1961
|
+
* @see fillHole
|
|
1962
|
+
*
|
|
1963
|
+
* @see StitchHolesParams
|
|
1964
|
+
*/
|
|
1965
|
+
stitchHoles(mesh: Mesh | null, a: number, b: number, params: StitchHolesParams): void;
|
|
713
1966
|
FixMeshDegeneraciesMode: {Decimate: FixMeshDegeneraciesModeValue<0>, Remesh: FixMeshDegeneraciesModeValue<1>, RemeshPatch: FixMeshDegeneraciesModeValue<2>};
|
|
714
1967
|
FixMeshDegeneraciesParams: {
|
|
715
1968
|
new(): FixMeshDegeneraciesParams;
|
|
716
1969
|
};
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
1970
|
+
/**
|
|
1971
|
+
* @brief Fixes degenerate faces and short edges in mesh (changes topology)
|
|
1972
|
+
*/
|
|
1973
|
+
fixMeshDegeneracies(mesh: Mesh | null, params: FixMeshDegeneraciesParams): void;
|
|
1974
|
+
/**
|
|
1975
|
+
* @brief resolves given multiple edges, but splitting all but one edge in each group
|
|
1976
|
+
*/
|
|
1977
|
+
fixMultipleEdges(mesh: Mesh | null): void;
|
|
1978
|
+
/**
|
|
1979
|
+
* @brief finds faces having aspect ratio >= criticalAspectRatio
|
|
1980
|
+
*/
|
|
1981
|
+
findDegenerateFaces(mp: Mesh | null, criticalAspectRatio: number): FaceBitSet;
|
|
1982
|
+
/**
|
|
1983
|
+
* @brief finds edges having length <= criticalLength
|
|
1984
|
+
*/
|
|
1985
|
+
findShortEdges(mp: Mesh | null, criticalLength: number): UndirectedEdgeBitSet;
|
|
1986
|
+
/**
|
|
1987
|
+
* @brief adds in complicatingFaces the faces not from the wedge with largest angle of faces connected by edges incident to given vertex
|
|
1988
|
+
*/
|
|
1989
|
+
findHoleComplicatingFaces(mesh: Mesh | null): FaceBitSet;
|
|
722
1990
|
MeshLoad: {
|
|
723
|
-
|
|
1991
|
+
/**
|
|
1992
|
+
* @brief loads mesh from file in the format detected from file extension
|
|
1993
|
+
*/
|
|
1994
|
+
fromAnySupportedFormat(path: EmbindString): Mesh | null;
|
|
724
1995
|
};
|
|
725
|
-
|
|
1996
|
+
MeshMeshCollisionStatus: {BothOutside: MeshMeshCollisionStatusValue<0>, BothInside: MeshMeshCollisionStatusValue<1>, AInside: MeshMeshCollisionStatusValue<2>, BInside: MeshMeshCollisionStatusValue<3>, Colliding: MeshMeshCollisionStatusValue<4>, Touching: MeshMeshCollisionStatusValue<5>, NotColliding: MeshMeshCollisionStatusValue<6>};
|
|
1997
|
+
/**
|
|
1998
|
+
* @brief computes minimal distance between two meshes or two mesh regions
|
|
1999
|
+
*
|
|
2000
|
+
* @param rigidB2A rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
|
|
2001
|
+
* @param upDistLimitSq upper limit on the distance in question, if the real distance is larger then the function exists returning upDistLimitSq and no valid points
|
|
2002
|
+
*/
|
|
2003
|
+
findDistance(a: Mesh | null, b: Mesh | null): MeshDistanceResult;
|
|
2004
|
+
findSignedDistanceFromMesh(a: Mesh | null, b: Mesh | null): MeshMeshSignedDistanceResult;
|
|
726
2005
|
FillHoleMetric: {};
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
2006
|
+
/**
|
|
2007
|
+
* This metric minimizes the sum of circumcircle radii for all triangles in the triangulation. It is rather fast to calculate, and it results in typically good triangulations. It is measured in length units.
|
|
2008
|
+
*/
|
|
2009
|
+
getCircumscribedMetric(mesh: Mesh | null): FillHoleMetric;
|
|
2010
|
+
/**
|
|
2011
|
+
* Same as getCircumscribedFillMetric, but with extra penalty for the triangles having normals looking in the opposite side of plane containing left of (e). It is measured in length units.
|
|
2012
|
+
*/
|
|
2013
|
+
getPlaneFillMetric(mesh: Mesh | null, e: number): FillHoleMetric;
|
|
2014
|
+
/**
|
|
2015
|
+
* Similar to getPlaneFillMetric with extra penalty for the triangles having normals looking in the opposite side of plane containing left of (e), but the metric minimizes the sum of circumcircle radius times aspect ratio for all triangles in the triangulation. It is measured in length units.
|
|
2016
|
+
*/
|
|
2017
|
+
getPlaneNormalizedFillMetric(mesh: Mesh | null, e: number): FillHoleMetric;
|
|
2018
|
+
/**
|
|
2019
|
+
* This metric minimizes the sum of triangleMetric for all triangles in the triangulation plus the sum edgeMetric for all edges inside and on the boundary of the triangulation.
|
|
2020
|
+
* Where
|
|
2021
|
+
* triangleMetric is proportional to weighted triangle area and triangle aspect ratio
|
|
2022
|
+
* edgeMetric grows with angle between triangles as ( ( 1 - cos( x ) ) / ( 1 + cos( x ) ) ) ^ 4. It is unitless.
|
|
2023
|
+
*/
|
|
2024
|
+
getComplexFillMetric(mesh: Mesh | null, e: number): FillHoleMetric;
|
|
2025
|
+
/**
|
|
2026
|
+
* Simple metric minimizing the sum of all edge lengths It is measured in length units.
|
|
2027
|
+
*/
|
|
2028
|
+
getEdgeLengthFillMetric(mesh: Mesh | null): FillHoleMetric;
|
|
2029
|
+
/**
|
|
2030
|
+
* This metric consists of two parts 1) for each triangle: it is the circumcircle diameter, this avoids the appearance of degenerate triangles; 2) for each edge: square root of double total area of triangles to its left and right times the factor depending extensionally on absolute dihedral angle between left and right triangles, this makes visually triangulated surface as smooth as possible. It is measured in length units. For planar holes it is the same as getCircumscribedMetric.
|
|
2031
|
+
*/
|
|
2032
|
+
getUniversalMetric(mesh: Mesh | null): FillHoleMetric;
|
|
2033
|
+
/**
|
|
2034
|
+
* This metric is for triangulation construction with minimal summed area of triangles. It is measured in squared length units. Warning: this metric can produce degenerated triangles
|
|
2035
|
+
*/
|
|
2036
|
+
getMinAreaMetric(mesh: Mesh | null): FillHoleMetric;
|
|
2037
|
+
/**
|
|
2038
|
+
* @brief Computes combined metric after filling a hole.
|
|
2039
|
+
*/
|
|
2040
|
+
calcCombinedFillMetric(mesh: Mesh | null, filledRegion: FaceBitSet, metric: FillHoleMetric): number;
|
|
735
2041
|
MeshOrPoints: {
|
|
736
|
-
fromMesh(
|
|
737
|
-
fromPoints(
|
|
2042
|
+
fromMesh(m: Mesh): MeshOrPoints;
|
|
2043
|
+
fromPoints(pc: PointCloud): MeshOrPoints;
|
|
738
2044
|
};
|
|
739
2045
|
MeshOrPointsXf: {
|
|
740
|
-
new(
|
|
2046
|
+
new(obj: MeshOrPoints, xf: AffineXf3f): MeshOrPointsXf;
|
|
741
2047
|
};
|
|
742
2048
|
MeshRelaxParams: {
|
|
743
2049
|
new(): MeshRelaxParams;
|
|
744
2050
|
};
|
|
745
|
-
|
|
746
|
-
|
|
2051
|
+
/**
|
|
2052
|
+
* applies given number of relaxation iterations to the whole mesh ( or some region if it is specified ) @returns true if was finished successfully, false if was interrupted by progress callback
|
|
2053
|
+
*/
|
|
2054
|
+
relax(mesh: Mesh | null, params: MeshRelaxParams): boolean;
|
|
2055
|
+
/**
|
|
2056
|
+
* applies given number of relaxation iterations to the whole mesh ( or some region if it is specified )
|
|
2057
|
+
* do not really keeps volume but tries hard @returns true if the operation completed successfully, and false if it was interrupted by the progress callback.
|
|
2058
|
+
*/
|
|
2059
|
+
relaxKeepVolume(mesh: Mesh | null, params: MeshRelaxParams): boolean;
|
|
747
2060
|
MeshSave: {
|
|
748
|
-
|
|
2061
|
+
/**
|
|
2062
|
+
* @brief detects the format from file extension and save mesh to it
|
|
2063
|
+
*/
|
|
2064
|
+
toAnySupportedFormat(mesh: Mesh | null, path: EmbindString): void;
|
|
2065
|
+
};
|
|
2066
|
+
SubdivideSettings: {
|
|
2067
|
+
new(): SubdivideSettings;
|
|
749
2068
|
};
|
|
2069
|
+
/**
|
|
2070
|
+
* splits edges in mesh region according to the settings;
|
|
2071
|
+
* @returns The total number of edge splits performed
|
|
2072
|
+
*/
|
|
2073
|
+
subdivideMesh(mesh: Mesh | null, settings: SubdivideSettings): number;
|
|
750
2074
|
MeshTopology: {};
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
2075
|
+
/**
|
|
2076
|
+
* returns given region with all faces sharing an edge with a region face; @param stopEdges - neighborhood via this edges will be ignored
|
|
2077
|
+
*/
|
|
2078
|
+
expandFaces(topology: MeshTopology, region: FaceBitSet): FaceBitSet;
|
|
2079
|
+
/**
|
|
2080
|
+
* returns given region without all faces sharing an edge with not-region face; @param stopEdges - neighborhood via this edges will be ignored
|
|
2081
|
+
*/
|
|
2082
|
+
shrinkFaces(topology: MeshTopology, region: FaceBitSet): FaceBitSet;
|
|
2083
|
+
/**
|
|
2084
|
+
* @brief returns faces from given region that have at least one neighbor face with shared edge not from the region
|
|
2085
|
+
*/
|
|
2086
|
+
getBoundaryFaces(topology: MeshTopology, region: FaceBitSet): FaceBitSet;
|
|
2087
|
+
expandVerts(topology: MeshTopology, region: VertBitSet, hops: number): VertBitSet;
|
|
2088
|
+
shrinkVerts(topology: MeshTopology, region: VertBitSet, hops: number): VertBitSet;
|
|
2089
|
+
/**
|
|
2090
|
+
* Combines unordered input intersections (and flips orientation of intersected edges from mesh B) into ordered oriented contours with the properties:
|
|
2091
|
+
* 1. Each contour is a. either closed (then its first and last elements are equal), b. or open (then its first and last intersected edges are boundary edges).
|
|
2092
|
+
* 2. Next intersection in a contour is located to the left of the current intersected edge: a. if the current and next intersected triangles are the same, then next intersected edge is either next( curr.edge ) or prev( curr.edge.sym() ).sym(), b. otherwise next intersected triangle is left( curr.edge ) and next intersected edge is one of the edges having the current intersected triangle to the right.
|
|
2093
|
+
* 3. Orientation of intersected edges in each pair of (intersected edge, intersected triangle): a. the intersected edge of mesh A is directed from negative half-space of the intersected triangle from mesh B to its positive half-space, b. the intersected edge of mesh B is directed from positive half-space of the intersected triangle from mesh A to its negative half-space.
|
|
2094
|
+
* 4. Orientation of contours: a. left of contours on mesh A is inside of mesh B (consequence of 3a), b. right of contours on mesh B is inside of mesh A (consequence of 3b).
|
|
2095
|
+
*/
|
|
2096
|
+
orderIntersectionContours(topologyA: MeshTopology, topologyB: MeshTopology, intersections: PreciseCollisionResult): ContinuousContours;
|
|
757
2097
|
CascadeMode: {Sequential: CascadeModeValue<0>, AABBTreeBased: CascadeModeValue<1>};
|
|
758
2098
|
MultiwayICPSamplingParameters: {
|
|
759
2099
|
new(): MultiwayICPSamplingParameters;
|
|
760
2100
|
};
|
|
761
2101
|
MultiwayICP: {
|
|
762
|
-
new(
|
|
2102
|
+
new(objects: readonly MeshOrPointsXf[], params: MultiwayICPSamplingParameters): MultiwayICP;
|
|
763
2103
|
};
|
|
2104
|
+
DenoiseViaNormalsSettings: {
|
|
2105
|
+
new(): DenoiseViaNormalsSettings;
|
|
2106
|
+
};
|
|
2107
|
+
/**
|
|
2108
|
+
* Reduces noise in given mesh, see the article "Mesh Denoising via a Novel Mumford-Shah Framework"
|
|
2109
|
+
*/
|
|
2110
|
+
meshDenoiseViaNormals(mesh: Mesh | null): void;
|
|
2111
|
+
/**
|
|
2112
|
+
* Reduces noise in given mesh, see the article "Mesh Denoising via a Novel Mumford-Shah Framework"
|
|
2113
|
+
*/
|
|
2114
|
+
meshDenoiseViaNormals(mesh: Mesh | null, settings: DenoiseViaNormalsSettings): void;
|
|
764
2115
|
BaseShellParameters: {
|
|
765
2116
|
new(): BaseShellParameters;
|
|
766
2117
|
};
|
|
@@ -773,55 +2124,176 @@ interface EmbindModule {
|
|
|
773
2124
|
GeneralOffsetParameters: {
|
|
774
2125
|
new(): GeneralOffsetParameters;
|
|
775
2126
|
};
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
2127
|
+
/**
|
|
2128
|
+
* @brief computes size of a cubical voxel to get approximately given number of voxels during rasterization
|
|
2129
|
+
*/
|
|
2130
|
+
suggestVoxelSize(mp: Mesh | null, approxNumVoxels: number): number;
|
|
2131
|
+
/**
|
|
2132
|
+
* Offsets mesh by converting it to distance field in voxels using OpenVDB library, signDetectionMode = Unsigned(from OpenVDB) | OpenVDB | HoleWindingRule, and then converts back using OpenVDB library (dual marching cubes), so result mesh is always closed
|
|
2133
|
+
*/
|
|
2134
|
+
offsetMesh(mp: Mesh | null, offset: number, params: OffsetParameters): Mesh | null;
|
|
2135
|
+
/**
|
|
2136
|
+
* Offsets mesh by converting it to voxels and back two times only closed meshes allowed (only Offset mode) typically offsetA and offsetB have distinct signs
|
|
2137
|
+
*/
|
|
2138
|
+
doubleOffsetMesh(mp: Mesh | null, offsetA: number, offsetB: number, params: OffsetParameters): Mesh | null;
|
|
2139
|
+
/**
|
|
2140
|
+
* Offsets mesh by converting it to distance field in voxels (using OpenVDB library if SignDetectionMode::OpenVDB or our implementation otherwise) and back using standard Marching Cubes, as opposed to Dual Marching Cubes in offsetMesh(...)
|
|
2141
|
+
*/
|
|
2142
|
+
mcOffsetMesh(mp: Mesh | null, offset: number, params: OffsetParameters): Mesh | null;
|
|
2143
|
+
/**
|
|
2144
|
+
* Constructs a shell around selected mesh region with the properties that every point on the shall must
|
|
2145
|
+
* 1. be located not further than given distance from selected mesh part,
|
|
2146
|
+
* 2. be located not closer to not-selected mesh part than to selected mesh part.
|
|
2147
|
+
*/
|
|
2148
|
+
mcShellMeshRegion(mesh: Mesh | null, region: FaceBitSet, offset: number, params: BaseShellParameters): Mesh | null;
|
|
2149
|
+
/**
|
|
2150
|
+
* Offsets mesh by converting it to voxels and back post process result using reference mesh to sharpen features
|
|
2151
|
+
*/
|
|
2152
|
+
sharpOffsetMesh(mp: Mesh | null, offset: number, params: SharpOffsetParameters): Mesh | null;
|
|
2153
|
+
/**
|
|
2154
|
+
* Offsets mesh by converting it to voxels and back using one of three modes specified in the parameters
|
|
2155
|
+
*/
|
|
2156
|
+
generalOffsetMesh(mp: Mesh | null, offset: number, params: GeneralOffsetParameters): Mesh | null;
|
|
2157
|
+
/**
|
|
2158
|
+
* @brief mapping between original mesh and thicken result
|
|
2159
|
+
*
|
|
2160
|
+
* in case of positive offset, returns the mesh consisting of offset mesh merged with inversed original mesh (thickening mode); in case of negative offset, returns the mesh consisting of inversed offset mesh merged with original mesh (hollowing mode); if your input mesh is open then please specify params.signDetectionMode = SignDetectionMode::Unsigned, and you will get open mesh (with several components) on output if your input mesh is closed then please specify another sign detection mode, and you will get closed mesh (with several components) on output;
|
|
2161
|
+
*/
|
|
2162
|
+
thickenMesh(mesh: Mesh | null, offset: number, params: GeneralOffsetParameters): Mesh | null;
|
|
784
2163
|
OneMeshContours: {};
|
|
785
|
-
|
|
2164
|
+
/**
|
|
2165
|
+
* @brief Cuts mesh by given contours.
|
|
2166
|
+
*
|
|
2167
|
+
* This function cuts mesh making new edges paths on place of input contours @param mesh Input mesh that will be cut
|
|
2168
|
+
* @param contours Input contours to cut mesh with, find more MR::OneMeshContours
|
|
2169
|
+
* @param params Parameters describing some cut options, find more MR::CutMeshParameters
|
|
2170
|
+
*
|
|
2171
|
+
* @returns New edges that correspond to given contours, find more MR::CutMeshResult
|
|
2172
|
+
*
|
|
2173
|
+
* @warning Input contours should have no intersections, faces where contours intersects (`bad faces`) will not be allowed for fill
|
|
2174
|
+
*
|
|
2175
|
+
* @warning Input mesh will be changed in any case, if `bad faces` are in mesh, mesh will be spoiled,
|
|
2176
|
+
* so if you cannot guarantee contours without intersections better make copy of mesh, before using this function
|
|
2177
|
+
*/
|
|
2178
|
+
cutMesh(mesh: Mesh | null, contours: OneMeshContours, params: CutMeshParameters): CutMeshResult;
|
|
786
2179
|
PointCloud: {
|
|
787
2180
|
new(): PointCloud;
|
|
788
2181
|
};
|
|
789
|
-
makeConvexHullFromPoints(
|
|
790
|
-
|
|
2182
|
+
makeConvexHullFromPoints(pointCloud: PointCloud): Mesh | null;
|
|
2183
|
+
/**
|
|
2184
|
+
* Mesh to PointCloud
|
|
2185
|
+
*/
|
|
2186
|
+
meshToPointCloud(mesh: Mesh | null, saveNormals: boolean): PointCloud;
|
|
2187
|
+
/**
|
|
2188
|
+
* @brief Finds the radius of ball, so on average that ball contained avgPoints excluding the central point.
|
|
2189
|
+
*
|
|
2190
|
+
* @param samples the number of test points to find given number of samples in each
|
|
2191
|
+
*/
|
|
2192
|
+
findAvgPointsRadius(pointCloud: PointCloud, avgPoints: number): number;
|
|
2193
|
+
/**
|
|
2194
|
+
* @brief Finds the radius of ball, so on average that ball contained avgPoints excluding the central point.
|
|
2195
|
+
*
|
|
2196
|
+
* @param samples the number of test points to find given number of samples in each
|
|
2197
|
+
*/
|
|
2198
|
+
findAvgPointsRadius(pointCloud: PointCloud, avgPoints: number, samples: number): number;
|
|
791
2199
|
TriangulationParameters: {
|
|
792
2200
|
new(): TriangulationParameters;
|
|
793
2201
|
};
|
|
794
|
-
|
|
2202
|
+
/**
|
|
2203
|
+
* @brief Creates mesh from given point cloud according params Returns empty optional if was interrupted by progress bar.
|
|
2204
|
+
*/
|
|
2205
|
+
triangulatePointCloud(pointCloud: PointCloud, params: TriangulationParameters): Mesh | null;
|
|
795
2206
|
PointsLoad: {
|
|
796
|
-
|
|
2207
|
+
/**
|
|
2208
|
+
* @brief detects the format from file extension and loads points from it
|
|
2209
|
+
*/
|
|
2210
|
+
fromAnySupportedFormat(path: EmbindString): PointCloud;
|
|
797
2211
|
};
|
|
798
2212
|
PointsSave: {
|
|
799
|
-
|
|
2213
|
+
/**
|
|
2214
|
+
* @brief detects the format from file extension and save points to it
|
|
2215
|
+
*/
|
|
2216
|
+
toAnySupportedFormat(points: PointCloud, path: EmbindString): void;
|
|
2217
|
+
};
|
|
2218
|
+
PointsToMeshParameters: {
|
|
2219
|
+
new(): PointsToMeshParameters;
|
|
800
2220
|
};
|
|
2221
|
+
/**
|
|
2222
|
+
* makes mesh from points with normals by constructing intermediate volume with signed distances and then using marching cubes algorithm to extract the surface from there
|
|
2223
|
+
*/
|
|
2224
|
+
pointsToMeshFusion(cloud: PointCloud, params: PointsToMeshParameters): Mesh | null;
|
|
801
2225
|
MeshProjectionParameters: {
|
|
802
2226
|
new(): MeshProjectionParameters;
|
|
803
2227
|
};
|
|
804
|
-
|
|
2228
|
+
/**
|
|
2229
|
+
* @brief if projector is not given then CPU's computations will be used
|
|
2230
|
+
*
|
|
2231
|
+
* Computes signed distances from given test points to the closest point on the reference mesh: positive value - outside reference mesh, negative - inside reference mesh; this method can return wrong sign if the closest point is located on self-intersecting part of the mesh
|
|
2232
|
+
*/
|
|
2233
|
+
findSignedDistances(refMesh: Mesh | null, mesh: Mesh | null, params: MeshProjectionParameters): Float32Array;
|
|
805
2234
|
CoordinateConverters: {};
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
2235
|
+
/**
|
|
2236
|
+
* @brief creates simple converters from Vector3f to Vector3i and back in mesh parts area range
|
|
2237
|
+
*
|
|
2238
|
+
* @param rigidB2A rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
|
|
2239
|
+
*/
|
|
2240
|
+
getVectorConverters(a: Mesh, b: Mesh): CoordinateConverters;
|
|
2241
|
+
/**
|
|
2242
|
+
* @brief finds all pairs of colliding edges from one mesh and triangle from another mesh
|
|
2243
|
+
*
|
|
2244
|
+
* @param rigidB2A rigid transformation from B-mesh space to A mesh space, nullptr considered as identity transformation
|
|
2245
|
+
* @param anyIntersection if true then the function returns as fast as it finds any intersection
|
|
2246
|
+
*/
|
|
2247
|
+
findCollidingEdgeTrisPrecise(a: Mesh, b: Mesh, conv: CoordinateConverters): PreciseCollisionResult;
|
|
2248
|
+
/**
|
|
2249
|
+
* @brief if true, then open self-intersection contours will be prolonged to terminal vertices
|
|
2250
|
+
*
|
|
2251
|
+
* Converts contours given in topological terms as the intersections of one mesh's edge and another mesh's triangle (ContinuousContours), into contours of meshA and/or meshB given as a sequence of (primitiveId and Cartesian coordinates); converters are required for better precision in case of degenerations; note that contours should not have intersections
|
|
2252
|
+
*/
|
|
2253
|
+
getOneMeshIntersectionContours(meshA: Mesh, meshB: Mesh, contours: ContinuousContours, getMeshAIntersections: boolean, converters: CoordinateConverters): OneMeshContours;
|
|
2254
|
+
getIncidentVertsFromFaces(topology: MeshTopology, faces: FaceBitSet): VertBitSet;
|
|
2255
|
+
getIncidentVertsFromEdges(topology: MeshTopology, edges: UndirectedEdgeBitSet): VertBitSet;
|
|
2256
|
+
getIncidentFacesFromVerts(topology: MeshTopology, verts: VertBitSet): FaceBitSet;
|
|
2257
|
+
getIncidentFacesFromEdges(topology: MeshTopology, edges: UndirectedEdgeBitSet): FaceBitSet;
|
|
2258
|
+
getIncidentEdgesFromFaces(topology: MeshTopology, faces: FaceBitSet): UndirectedEdgeBitSet;
|
|
2259
|
+
getIncidentEdgesFromEdges(topology: MeshTopology, edges: UndirectedEdgeBitSet): UndirectedEdgeBitSet;
|
|
2260
|
+
getInnerVertsFromFaces(topology: MeshTopology, region: FaceBitSet): VertBitSet;
|
|
2261
|
+
getInnerVertsFromEdges(topology: MeshTopology, edges: UndirectedEdgeBitSet): VertBitSet;
|
|
2262
|
+
/**
|
|
2263
|
+
* @brief composes the set of all faces with all their vertices in given set
|
|
2264
|
+
*/
|
|
2265
|
+
getInnerFaces(topology: MeshTopology, verts: VertBitSet): FaceBitSet;
|
|
2266
|
+
getInnerEdgesFromVerts(topology: MeshTopology, verts: VertBitSet): UndirectedEdgeBitSet;
|
|
2267
|
+
getInnerEdgesFromFaces(topology: MeshTopology, region: FaceBitSet): UndirectedEdgeBitSet;
|
|
2268
|
+
/**
|
|
2269
|
+
* @brief composes the set of all boundary vertices for given region (or whole mesh if !region)
|
|
2270
|
+
*/
|
|
2271
|
+
getBoundaryVerts(topology: MeshTopology, region: FaceBitSet): VertBitSet;
|
|
2272
|
+
/**
|
|
2273
|
+
* @brief same as above, but writes the loop in `outLoop` (cleared first), so a caller tracking many loops one by one reuses its capacity
|
|
2274
|
+
*/
|
|
2275
|
+
trackRightBoundaryLoop(topology: MeshTopology, e0: number): Uint32Array;
|
|
2276
|
+
/**
|
|
2277
|
+
* returns all region boundary loops; every loop has region faces on the right, and not-region faces or holes on the left
|
|
2278
|
+
*/
|
|
2279
|
+
findRightBoundary(topology: MeshTopology): Uint32Array[];
|
|
2280
|
+
/**
|
|
2281
|
+
* @brief how to determine the sign of distances from a mesh
|
|
2282
|
+
*/
|
|
823
2283
|
SignDetectionMode: {Unsigned: SignDetectionModeValue<0>, OpenVDB: SignDetectionModeValue<1>, ProjectionNormal: SignDetectionModeValue<2>, WindingRule: SignDetectionModeValue<3>, HoleWindingRule: SignDetectionModeValue<4>};
|
|
824
|
-
makeTorus(
|
|
2284
|
+
makeTorus(): Mesh | null;
|
|
2285
|
+
makeTorus(primaryRadius: number): Mesh | null;
|
|
2286
|
+
makeTorus(primaryRadius: number, secondaryRadius: number): Mesh | null;
|
|
2287
|
+
makeTorus(primaryRadius: number, secondaryRadius: number, primaryResolution: number): Mesh | null;
|
|
2288
|
+
makeTorus(primaryRadius: number, secondaryRadius: number, primaryResolution: number, secondaryResolution: number): Mesh | null;
|
|
2289
|
+
makeTorusWithSelfIntersections(primaryRadius: number, secondaryRadius: number, primaryResolution: number, secondaryResolution: number): Mesh | null;
|
|
2290
|
+
UniformSamplingSettings: {
|
|
2291
|
+
new(): UniformSamplingSettings;
|
|
2292
|
+
};
|
|
2293
|
+
/**
|
|
2294
|
+
* Sample vertices, removing ones that are too close; returns std::nullopt if it was terminated by the callback
|
|
2295
|
+
*/
|
|
2296
|
+
pointUniformSampling(pointCloud: PointCloud, settings: UniformSamplingSettings): VertBitSet;
|
|
825
2297
|
MeshToVolumeType: {Signed: MeshToVolumeTypeValue<0>, Unsigned: MeshToVolumeTypeValue<1>};
|
|
826
2298
|
MeshToVolumeParams: {
|
|
827
2299
|
new(): MeshToVolumeParams;
|
|
@@ -829,45 +2301,106 @@ interface EmbindModule {
|
|
|
829
2301
|
GridToMeshSettings: {
|
|
830
2302
|
new(): GridToMeshSettings;
|
|
831
2303
|
};
|
|
832
|
-
evalGridMinMax(
|
|
833
|
-
|
|
2304
|
+
evalGridMinMax(grid: FloatGrid): GridMinMax;
|
|
2305
|
+
/**
|
|
2306
|
+
* @brief converts OpenVDB Grid into mesh using Dual Marching Cubes algorithm
|
|
2307
|
+
*/
|
|
2308
|
+
gridToMesh(grid: FloatGrid, settings: GridToMeshSettings): Mesh | null;
|
|
834
2309
|
VdbVolume: {};
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
2310
|
+
/**
|
|
2311
|
+
* converts mesh (or its part) into a volume filled with signed or unsigned distances to mesh using OpenVDB library; for signed distances the mesh must be closed; prior to conversion, world space is shifted to ensure that the bounding box of offset mesh is in positive quarter-space, and the shift is written in *params.outXf
|
|
2312
|
+
*/
|
|
2313
|
+
meshToVolume(mp: Mesh | null, params: MeshToVolumeParams): VdbVolume;
|
|
2314
|
+
/**
|
|
2315
|
+
* converts mesh (or its part) into a volume filled with signed or unsigned distances to mesh using OpenVDB library; for signed distances the mesh must be closed; *params.outXf is untouched
|
|
2316
|
+
*/
|
|
2317
|
+
meshToDistanceVdbVolume(mp: Mesh | null, params: MeshToVolumeParams): VdbVolume;
|
|
2318
|
+
floatGridToVdbVolume(grid: FloatGrid): VdbVolume;
|
|
838
2319
|
VertCoords: {
|
|
839
|
-
fromArray(
|
|
2320
|
+
fromArray(array: Float32Array): VertCoords;
|
|
2321
|
+
};
|
|
2322
|
+
/**
|
|
2323
|
+
* @brief returns a vector with vertex normals in every element for valid mesh vertices
|
|
2324
|
+
*/
|
|
2325
|
+
computePerVertNormals(mesh: Mesh | null): VertCoords;
|
|
2326
|
+
VertScalars: {
|
|
2327
|
+
fromArray(array: Float32Array): VertScalars;
|
|
840
2328
|
};
|
|
841
|
-
computePerVertNormals(_0: Mesh | null): VertCoords;
|
|
842
2329
|
Triangulation: {
|
|
843
|
-
fromArray(
|
|
2330
|
+
fromArray(array: Uint32Array): Triangulation;
|
|
844
2331
|
};
|
|
845
2332
|
FaceNormals: {
|
|
846
|
-
fromArray(
|
|
2333
|
+
fromArray(array: Float32Array): FaceNormals;
|
|
847
2334
|
};
|
|
848
|
-
|
|
2335
|
+
/**
|
|
2336
|
+
* @brief returns a vector with face-normal in every element for valid mesh faces
|
|
2337
|
+
*/
|
|
2338
|
+
computePerFaceNormals(mesh: Mesh | null): FaceNormals;
|
|
849
2339
|
VertMap: {
|
|
850
|
-
fromArray(
|
|
2340
|
+
fromArray(array: Uint32Array): VertMap;
|
|
851
2341
|
};
|
|
852
2342
|
FaceMap: {
|
|
853
|
-
fromArray(
|
|
2343
|
+
fromArray(array: Uint32Array): FaceMap;
|
|
854
2344
|
};
|
|
855
2345
|
Face2RegionMap: {
|
|
856
|
-
fromArray(
|
|
2346
|
+
fromArray(array: Uint32Array): Face2RegionMap;
|
|
857
2347
|
};
|
|
858
2348
|
VertColors: {
|
|
859
|
-
fromArray(
|
|
2349
|
+
fromArray(array: Uint8Array): VertColors;
|
|
2350
|
+
};
|
|
2351
|
+
/**
|
|
2352
|
+
* creates box mesh with given min-corner (base) and given size in every dimension; with default parameters, creates unit cube mesh with the centroid in (0,0,0)
|
|
2353
|
+
*/
|
|
2354
|
+
makeCube(size: Vector3f): Mesh | null;
|
|
2355
|
+
/**
|
|
2356
|
+
* creates box mesh with given min-corner (base) and given size in every dimension; with default parameters, creates unit cube mesh with the centroid in (0,0,0)
|
|
2357
|
+
*/
|
|
2358
|
+
makeCube(size: Vector3f, base: Vector3f): Mesh | null;
|
|
2359
|
+
/**
|
|
2360
|
+
* @brief computes the closest point on mesh (or its region) to given point
|
|
2361
|
+
*
|
|
2362
|
+
* @param upDistLimitSq upper limit on the distance in question, if the real distance is larger then the function exits returning upDistLimitSq and no valid point
|
|
2363
|
+
* @param xf mesh-to-point transformation, if not specified then identity transformation is assumed
|
|
2364
|
+
* @param loDistLimitSq low limit on the distance in question, if a point is found within this distance then it is immediately returned without searching for a closer one
|
|
2365
|
+
* @param validFaces if provided then only faces from there will be considered as projections
|
|
2366
|
+
* @param validProjections if provided then only projections passed this test can be returned
|
|
2367
|
+
*/
|
|
2368
|
+
findProjection(pt: Vector3f, mp: Mesh | null): MeshProjectionResult;
|
|
2369
|
+
findSignedDistanceFromPoint(pt: Vector3f, mp: Mesh | null): SignedMeshProjectionResult;
|
|
2370
|
+
/**
|
|
2371
|
+
* @brief returns the value at given voxel
|
|
2372
|
+
*/
|
|
2373
|
+
getValue(grid: FloatGrid, p: Vector3i): number;
|
|
2374
|
+
/**
|
|
2375
|
+
* sets given region voxels value @note region is in grid space (0 voxel id is minimum active voxel in grid)
|
|
2376
|
+
*/
|
|
2377
|
+
setValue(grid: FloatGrid, p: Vector3i, value: number): void;
|
|
2378
|
+
Vector3: {
|
|
2379
|
+
plusZ(): Vector3f;
|
|
2380
|
+
diagonal(a: number): Vector3f;
|
|
2381
|
+
add(a: Vector3f, b: Vector3f): Vector3f;
|
|
2382
|
+
mulScalar(v: Vector3f, s: number): Vector3f;
|
|
860
2383
|
};
|
|
861
|
-
makeCube(_0: Vector3f, _1: Vector3f): Mesh | null;
|
|
862
|
-
findProjection(_0: Vector3f, _1: Mesh | null): any;
|
|
863
|
-
findSignedDistance(_0: Vector3f, _1: Mesh | null): any;
|
|
864
|
-
getValue(_0: FloatGrid, _1: Vector3i): number;
|
|
865
|
-
setValue(_0: FloatGrid, _1: Vector3i, _2: number): void;
|
|
866
2384
|
VoxelsLoad: {
|
|
867
|
-
|
|
2385
|
+
/**
|
|
2386
|
+
* @brief Detects the format from file extension and loads voxels from it.
|
|
2387
|
+
*/
|
|
2388
|
+
fromAnySupportedFormat(path: EmbindString): VdbVolume[];
|
|
868
2389
|
};
|
|
869
2390
|
VoxelsSave: {
|
|
870
|
-
toAnySupportedFormat(
|
|
2391
|
+
toAnySupportedFormat(volume: VdbVolume, path: EmbindString): void;
|
|
2392
|
+
};
|
|
2393
|
+
WeightedShellParametersBase: {
|
|
2394
|
+
new(): WeightedShellParametersBase;
|
|
2395
|
+
};
|
|
2396
|
+
WeightedShellParametersMetric: {
|
|
2397
|
+
new(): WeightedShellParametersMetric;
|
|
2398
|
+
};
|
|
2399
|
+
WeightedShell: {
|
|
2400
|
+
/**
|
|
2401
|
+
* consider a mesh where each vertex has additive weight, and this weight is linearly interpolated in mesh triangles, and the distance to a point is considered equal to (euclidean distance - weight), constructs iso-surface of such distance field corresponding to params.offset value using marching cubes
|
|
2402
|
+
*/
|
|
2403
|
+
meshShell(mesh: Mesh | null, vertWeights: VertScalars, params: WeightedShellParametersMetric): Mesh | null;
|
|
871
2404
|
};
|
|
872
2405
|
}
|
|
873
2406
|
|