MeshLib C Docs
Loading...
Searching...
No Matches
MRMeshBuilder.h
Go to the documentation of this file.
1#pragma once
2
3#include <MRCMesh/MRId.h>
4#include <MRCMisc/common.h>
5#include <MRCMisc/exports.h>
6
7#include <stdbool.h>
8#include <stddef.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14typedef struct MR_FaceBitSet MR_FaceBitSet; // Defined in `#include <MRCMesh/MRBitSet.h>`.
15typedef struct MR_FaceMap MR_FaceMap; // Defined in `#include <MRCMesh/MRVector.h>`.
16typedef struct MR_Mesh MR_Mesh; // Defined in `#include <MRCMesh/MRMesh.h>`.
17typedef struct MR_MeshBuilder_BuildSettings MR_MeshBuilder_BuildSettings; // Defined in `#include <MRCMesh/MRMeshBuilderTypes.h>`.
18typedef struct MR_MeshTopology MR_MeshTopology; // Defined in `#include <MRCMesh/MRMeshTopology.h>`.
19typedef struct MR_Triangulation MR_Triangulation; // Defined in `#include <MRCMesh/MRVector.h>`.
20typedef struct MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId; // Defined in `#include <MRCMesh/MRVector.h>`.
21typedef struct MR_VertBitSet MR_VertBitSet; // Defined in `#include <MRCMesh/MRBitSet.h>`.
22typedef struct MR_VertMap MR_VertMap; // Defined in `#include <MRCMesh/MRVector.h>`.
23typedef struct MR_std_function_bool_from_float MR_std_function_bool_from_float; // Defined in `#include <MRCMisc/std_function_bool_from_float.h>`.
24typedef struct MR_std_vector_MR_MeshBuilder_MeshPiece MR_std_vector_MR_MeshBuilder_MeshPiece; // Defined in `#include <MRCMisc/std_vector_MR_MeshBuilder_MeshPiece.h>`.
25typedef struct MR_std_vector_MR_MeshBuilder_VertDuplication MR_std_vector_MR_MeshBuilder_VertDuplication; // Defined in `#include <MRCMisc/std_vector_MR_MeshBuilder_VertDuplication.h>`.
26typedef struct MR_std_vector_MR_VertId MR_std_vector_MR_VertId; // Defined in `#include <MRCMisc/std_vector_MR_VertId.h>`.
27typedef struct MR_std_vector_std_array_MR_Vector3f_3 MR_std_vector_std_array_MR_Vector3f_3; // Defined in `#include <MRCMisc/std_vector_std_array_MR_Vector3f_3.h>`.
28
29
33
34// a part of a whole mesh to be constructed
38
42
51MRC_API MR_MeshTopology *MR_MeshBuilder_fromTriangles(const MR_Triangulation *t, const MR_MeshBuilder_BuildSettings *settings, MR_PassBy progressCb_pass_by, MR_std_function_bool_from_float *progressCb);
52
53// original vertex before duplication
59
60// original vertex before duplication
66
67// original vertex before duplication
73
74// new vertex after duplication
80
81// new vertex after duplication
87
88// new vertex after duplication
94
98
103
110
114
118
124
127
130
138
139// resolve non-manifold vertices by creating duplicate vertices in the triangulation (which is modified)
140// `lastValidVert` is needed if `region` or `t` does not contain full mesh, then first duplicated vertex will have `lastValidVert+1` index
141// return number of duplicated vertices
148
149// construct mesh topology from a set of triangles with given ids;
150// unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices;
151// triangulation is modified to introduce duplicates
159
160// construct mesh from point triples;
161// all coinciding points are given the same VertId in the result
166
167// face of part -> face of whole mesh
173
174// face of part -> face of whole mesh
179MRC_API void MR_MeshBuilder_MeshPiece_Set_fmap(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_FaceMap *value);
180
181// face of part -> face of whole mesh
187
188// vert of part -> vert of whole mesh
194
195// vert of part -> vert of whole mesh
200MRC_API void MR_MeshBuilder_MeshPiece_Set_vmap(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_VertMap *value);
201
202// vert of part -> vert of whole mesh
208
214
219MRC_API void MR_MeshBuilder_MeshPiece_Set_topology(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_MeshTopology *value);
220
226
227// remaining triangles of part, not in topology
233
234// remaining triangles of part, not in topology
239MRC_API void MR_MeshBuilder_MeshPiece_Set_rem(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_FaceBitSet *value);
240
241// remaining triangles of part, not in topology
247
251
256
264MRC_API MR_MeshBuilder_MeshPiece *MR_MeshBuilder_MeshPiece_ConstructFrom(MR_PassBy fmap_pass_by, MR_FaceMap *fmap, MR_PassBy vmap_pass_by, MR_VertMap *vmap, MR_PassBy topology_pass_by, MR_MeshTopology *topology, MR_PassBy rem_pass_by, MR_FaceBitSet *rem);
265
269
273
278
281
284
291
292// construct mesh topology in parallel from given disjoint mesh pieces (which do not have any shared vertex)
293// and some additional triangles (in settings) that join the pieces
301
302// adds triangles in the existing topology, given face indecies must be free;
303// settings.region on output contain the remaining triangles that could not be added into the topology right now, but may be added later when other triangles appear in the mesh
310
311// adds triangles in the existing topology, auto selecting face ids for them;
312// vertTriples on output contain the remaining triangles that could not be added into the topology right now, but may be added later when other triangles appear in the mesh
318
328
334
339
345
351
356
362
368
374
380
386
391
397
403
409
415
421
427
433
437
442
449MRC_API MR_MeshBuilder_UniteCloseParams *MR_MeshBuilder_UniteCloseParams_ConstructFrom(float closeDist, bool uniteOnlyBd, MR_VertBitSet *region, bool duplicateNonManifold, MR_VertMap *optionalVertOldToNew, MR_std_vector_MR_MeshBuilder_VertDuplication *optionalDuplications);
450
454
458
464
467
470
478
488MRC_API int MR_MeshBuilder_uniteCloseVertices_4(MR_Mesh *mesh, float closeDist, const bool *uniteOnlyBd, MR_VertMap *optionalVertOldToNew);
489
498
499#ifdef __cplusplus
500} // extern "C"
501#endif
struct MR_MeshTopology MR_MeshTopology
Definition MR2DContoursTriangulation.h:15
struct MR_std_function_bool_from_float MR_std_function_bool_from_float
Definition MR3mf.h:10
struct MR_VertBitSet MR_VertBitSet
Definition MRAABBTree.h:22
struct MR_FaceBitSet MR_FaceBitSet
Definition MRAABBTree.h:17
struct MR_VertMap MR_VertMap
Definition MRBitSet.h:40
struct MR_FaceMap MR_FaceMap
Definition MRBitSet.h:26
struct MR_Mesh MR_Mesh
Definition MRCtm.h:16
struct MR_std_vector_MR_VertId MR_std_vector_MR_VertId
Definition MREdgePaths.h:29
struct MR_Triangulation MR_Triangulation
Definition MRIdentifyVertices.h:13
struct MR_std_vector_std_array_MR_Vector3f_3 MR_std_vector_std_array_MR_Vector3f_3
Definition MRIdentifyVertices.h:16
MRC_API const MR_VertMap * MR_MeshBuilder_MeshPiece_Get_vmap(const MR_MeshBuilder_MeshPiece *_this)
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_ConstructFrom(float closeDist, bool uniteOnlyBd, MR_VertBitSet *region, bool duplicateNonManifold, MR_VertMap *optionalVertOldToNew, MR_std_vector_MR_MeshBuilder_VertDuplication *optionalDuplications)
MRC_API MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_AssignFromAnother(MR_MeshBuilder_MeshPiece *_this, MR_PassBy _other_pass_by, MR_MeshBuilder_MeshPiece *_other)
MRC_API void MR_MeshBuilder_UniteCloseParams_Set_closeDist(MR_MeshBuilder_UniteCloseParams *_this, float value)
MRC_API void MR_MeshBuilder_MeshPiece_Set_vmap(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_VertMap *value)
MRC_API MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_OffsetMutablePtr(MR_MeshBuilder_MeshPiece *ptr, ptrdiff_t i)
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_DefaultConstruct(void)
MRC_API void MR_MeshBuilder_UniteCloseParams_Destroy(const MR_MeshBuilder_UniteCloseParams *_this)
Destroys a heap-allocated instance of MR_MeshBuilder_UniteCloseParams. Does nothing if the pointer is...
MRC_API int MR_MeshBuilder_uniteCloseVertices_4(MR_Mesh *mesh, float closeDist, const bool *uniteOnlyBd, MR_VertMap *optionalVertOldToNew)
MRC_API MR_MeshTopology * MR_MeshBuilder_MeshPiece_GetMutable_topology(MR_MeshBuilder_MeshPiece *_this)
MRC_API MR_MeshTopology * MR_MeshBuilder_fromTriangles(const MR_Triangulation *t, const MR_MeshBuilder_BuildSettings *settings, MR_PassBy progressCb_pass_by, MR_std_function_bool_from_float *progressCb)
struct MR_std_vector_MR_MeshBuilder_MeshPiece MR_std_vector_MR_MeshBuilder_MeshPiece
Definition MRMeshBuilder.h:24
MRC_API const MR_FaceBitSet * MR_MeshBuilder_MeshPiece_Get_rem(const MR_MeshBuilder_MeshPiece *_this)
MRC_API MR_MeshTopology * MR_MeshBuilder_fromFaceSoup(const MR_std_vector_MR_VertId *verts, const MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId *faces, const MR_MeshBuilder_BuildSettings *settings, MR_PassBy progressCb_pass_by, MR_std_function_bool_from_float *progressCb)
MRC_API MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_DefaultConstructArray(size_t num_elems)
MRC_API const MR_VertId * MR_MeshBuilder_VertDuplication_Get_srcVert(const MR_MeshBuilder_VertDuplication *_this)
MRC_API MR_VertId * MR_MeshBuilder_VertDuplication_GetMutable_dupVert(MR_MeshBuilder_VertDuplication *_this)
MRC_API MR_VertBitSet *const * MR_MeshBuilder_UniteCloseParams_Get_region(const MR_MeshBuilder_UniteCloseParams *_this)
MRC_API void MR_MeshBuilder_MeshPiece_Set_fmap(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_FaceMap *value)
MRC_API void MR_MeshBuilder_VertDuplication_DestroyArray(const MR_MeshBuilder_VertDuplication *_this)
Destroys a heap-allocated array of MR_MeshBuilder_VertDuplication. Does nothing if the pointer is nul...
MRC_API void MR_MeshBuilder_UniteCloseParams_Set_uniteOnlyBd(MR_MeshBuilder_UniteCloseParams *_this, bool value)
MRC_API MR_MeshTopology * MR_MeshBuilder_fromDisjointMeshPieces(const MR_Triangulation *t, MR_VertId maxVertId, const MR_std_vector_MR_MeshBuilder_MeshPiece *pieces, const MR_MeshBuilder_BuildSettings *settings)
MRC_API const MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_OffsetPtr(const MR_MeshBuilder_UniteCloseParams *ptr, ptrdiff_t i)
struct MR_MeshBuilder_MeshPiece MR_MeshBuilder_MeshPiece
Definition MRMeshBuilder.h:37
MRC_API void MR_MeshBuilder_UniteCloseParams_Set_duplicateNonManifold(MR_MeshBuilder_UniteCloseParams *_this, bool value)
MRC_API bool * MR_MeshBuilder_UniteCloseParams_GetMutable_duplicateNonManifold(MR_MeshBuilder_UniteCloseParams *_this)
MRC_API void MR_MeshBuilder_UniteCloseParams_Set_optionalDuplications(MR_MeshBuilder_UniteCloseParams *_this, MR_std_vector_MR_MeshBuilder_VertDuplication *value)
MRC_API void MR_MeshBuilder_addTriangles_MR_Triangulation(MR_MeshTopology *res, const MR_Triangulation *t, const MR_MeshBuilder_BuildSettings *settings)
MRC_API void MR_MeshBuilder_UniteCloseParams_Set_optionalVertOldToNew(MR_MeshBuilder_UniteCloseParams *_this, MR_VertMap *value)
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_AssignFromAnother(MR_MeshBuilder_UniteCloseParams *_this, const MR_MeshBuilder_UniteCloseParams *_other)
MRC_API MR_FaceMap * MR_MeshBuilder_MeshPiece_GetMutable_fmap(MR_MeshBuilder_MeshPiece *_this)
MRC_API void MR_MeshBuilder_UniteCloseParams_DestroyArray(const MR_MeshBuilder_UniteCloseParams *_this)
Destroys a heap-allocated array of MR_MeshBuilder_UniteCloseParams. Does nothing if the pointer is nu...
MRC_API MR_VertId * MR_MeshBuilder_VertDuplication_GetMutable_srcVert(MR_MeshBuilder_VertDuplication *_this)
MRC_API MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_DefaultConstructArray(size_t num_elems)
MRC_API MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_AssignFromAnother(MR_MeshBuilder_VertDuplication *_this, const MR_MeshBuilder_VertDuplication *_other)
MRC_API int MR_MeshBuilder_uniteCloseVertices_2(MR_Mesh *mesh, const MR_MeshBuilder_UniteCloseParams *params)
MRC_API const MR_MeshTopology * MR_MeshBuilder_MeshPiece_Get_topology(const MR_MeshBuilder_MeshPiece *_this)
MRC_API void MR_MeshBuilder_MeshPiece_DestroyArray(const MR_MeshBuilder_MeshPiece *_this)
Destroys a heap-allocated array of MR_MeshBuilder_MeshPiece. Does nothing if the pointer is null.
MRC_API MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_ConstructFrom(MR_VertId srcVert, MR_VertId dupVert)
struct MR_MeshBuilder_UniteCloseParams MR_MeshBuilder_UniteCloseParams
Definition MRMeshBuilder.h:41
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_OffsetMutablePtr(MR_MeshBuilder_UniteCloseParams *ptr, ptrdiff_t i)
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_DefaultConstructArray(size_t num_elems)
MRC_API const MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_OffsetPtr(const MR_MeshBuilder_VertDuplication *ptr, ptrdiff_t i)
MRC_API const bool * MR_MeshBuilder_UniteCloseParams_Get_duplicateNonManifold(const MR_MeshBuilder_UniteCloseParams *_this)
MRC_API MR_Mesh * MR_MeshBuilder_fromPointTriples(const MR_std_vector_std_array_MR_Vector3f_3 *posTriples)
MRC_API MR_uint64_t MR_MeshBuilder_duplicateNonManifoldVertices(MR_Triangulation *t, MR_FaceBitSet *region, MR_std_vector_MR_MeshBuilder_VertDuplication *dups, const MR_VertId *lastValidVert)
MRC_API const float * MR_MeshBuilder_UniteCloseParams_Get_closeDist(const MR_MeshBuilder_UniteCloseParams *_this)
MRC_API MR_VertBitSet ** MR_MeshBuilder_UniteCloseParams_GetMutable_region(MR_MeshBuilder_UniteCloseParams *_this)
MRC_API void MR_MeshBuilder_MeshPiece_Set_rem(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_FaceBitSet *value)
MRC_API void MR_MeshBuilder_MeshPiece_Destroy(const MR_MeshBuilder_MeshPiece *_this)
Destroys a heap-allocated instance of MR_MeshBuilder_MeshPiece. Does nothing if the pointer is null.
MRC_API const bool * MR_MeshBuilder_UniteCloseParams_Get_uniteOnlyBd(const MR_MeshBuilder_UniteCloseParams *_this)
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_ConstructFromAnother(const MR_MeshBuilder_UniteCloseParams *_other)
MRC_API MR_FaceBitSet * MR_MeshBuilder_MeshPiece_GetMutable_rem(MR_MeshBuilder_MeshPiece *_this)
MRC_API const MR_FaceMap * MR_MeshBuilder_MeshPiece_Get_fmap(const MR_MeshBuilder_MeshPiece *_this)
MRC_API MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_DefaultConstruct(void)
MRC_API MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_ConstructFromAnother(const MR_MeshBuilder_VertDuplication *_other)
MRC_API MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_ConstructFromAnother(MR_PassBy _other_pass_by, MR_MeshBuilder_MeshPiece *_other)
MRC_API void MR_MeshBuilder_MeshPiece_Set_topology(MR_MeshBuilder_MeshPiece *_this, MR_PassBy value_pass_by, MR_MeshTopology *value)
MRC_API MR_MeshTopology * MR_MeshBuilder_fromTrianglesDuplicatingNonManifoldVertices(MR_Triangulation *t, MR_std_vector_MR_MeshBuilder_VertDuplication *dups, const MR_MeshBuilder_BuildSettings *settings)
MRC_API void MR_MeshBuilder_VertDuplication_Set_dupVert(MR_MeshBuilder_VertDuplication *_this, MR_VertId value)
MRC_API void MR_MeshBuilder_addTriangles_std_vector_MR_VertId(MR_MeshTopology *res, MR_std_vector_MR_VertId *vertTriples, MR_FaceBitSet *createdFaces)
struct MR_MeshBuilder_VertDuplication MR_MeshBuilder_VertDuplication
Definition MRMeshBuilder.h:32
MRC_API void MR_MeshBuilder_VertDuplication_Destroy(const MR_MeshBuilder_VertDuplication *_this)
Destroys a heap-allocated instance of MR_MeshBuilder_VertDuplication. Does nothing if the pointer is ...
MRC_API MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_DefaultConstruct(void)
MRC_API bool * MR_MeshBuilder_UniteCloseParams_GetMutable_uniteOnlyBd(MR_MeshBuilder_UniteCloseParams *_this)
MRC_API const MR_VertId * MR_MeshBuilder_VertDuplication_Get_dupVert(const MR_MeshBuilder_VertDuplication *_this)
MRC_API MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_ConstructFrom(MR_PassBy fmap_pass_by, MR_FaceMap *fmap, MR_PassBy vmap_pass_by, MR_VertMap *vmap, MR_PassBy topology_pass_by, MR_MeshTopology *topology, MR_PassBy rem_pass_by, MR_FaceBitSet *rem)
MRC_API MR_VertMap *const * MR_MeshBuilder_UniteCloseParams_Get_optionalVertOldToNew(const MR_MeshBuilder_UniteCloseParams *_this)
MRC_API void MR_MeshBuilder_UniteCloseParams_Set_region(MR_MeshBuilder_UniteCloseParams *_this, MR_VertBitSet *value)
MRC_API MR_std_vector_MR_MeshBuilder_VertDuplication *const * MR_MeshBuilder_UniteCloseParams_Get_optionalDuplications(const MR_MeshBuilder_UniteCloseParams *_this)
MRC_API MR_VertMap * MR_MeshBuilder_MeshPiece_GetMutable_vmap(MR_MeshBuilder_MeshPiece *_this)
MRC_API float * MR_MeshBuilder_UniteCloseParams_GetMutable_closeDist(MR_MeshBuilder_UniteCloseParams *_this)
MRC_API MR_MeshBuilder_VertDuplication * MR_MeshBuilder_VertDuplication_OffsetMutablePtr(MR_MeshBuilder_VertDuplication *ptr, ptrdiff_t i)
MRC_API MR_VertMap ** MR_MeshBuilder_UniteCloseParams_GetMutable_optionalVertOldToNew(MR_MeshBuilder_UniteCloseParams *_this)
MRC_API void MR_MeshBuilder_VertDuplication_Set_srcVert(MR_MeshBuilder_VertDuplication *_this, MR_VertId value)
MRC_API MR_std_vector_MR_MeshBuilder_VertDuplication ** MR_MeshBuilder_UniteCloseParams_GetMutable_optionalDuplications(MR_MeshBuilder_UniteCloseParams *_this)
MRC_API const MR_MeshBuilder_MeshPiece * MR_MeshBuilder_MeshPiece_OffsetPtr(const MR_MeshBuilder_MeshPiece *ptr, ptrdiff_t i)
struct MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId
Definition MRMesh.h:40
struct MR_std_vector_MR_MeshBuilder_VertDuplication MR_std_vector_MR_MeshBuilder_VertDuplication
Definition MRMesh.h:51
struct MR_MeshBuilder_BuildSettings MR_MeshBuilder_BuildSettings
Definition MRMesh.h:25
Definition MRId.h:55