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
32
33// a part of a whole mesh to be constructed
36
39
49
50// original vertex before duplication
55
56// original vertex before duplication
60
61// original vertex before duplication
66
67// new vertex after duplication
72
73// new vertex after duplication
77
78// new vertex after duplication
83
87
92
96
99
102
107
110
113
119
120// resolve non-manifold vertices by creating duplicate vertices in the triangulation (which is modified)
121// `lastValidVert` is needed if `region` or `t` does not contain full mesh, then first duplicated vertex will have `lastValidVert+1` index
122// return number of duplicated vertices
129
130// construct mesh topology from a set of triangles with given ids;
131// unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices;
132// triangulation is modified to introduce duplicates
140
141// construct mesh from point triples;
142// all coinciding points are given the same VertId in the result
147
148// face of part -> face of whole mesh
153
154// face of part -> face of whole mesh
158
159// face of part -> face of whole mesh
164
165// vert of part -> vert of whole mesh
170
171// vert of part -> vert of whole mesh
175
176// vert of part -> vert of whole mesh
181
186
190
195
196// remaining triangles of part, not in topology
201
202// remaining triangles of part, not in topology
206
207// remaining triangles of part, not in topology
212
216
221
225
228
231
235
238
241
246
247// construct mesh topology in parallel from given disjoint mesh pieces (which do not have any shared vertex)
248// and some additional triangles (in settings) that join the pieces
256
257// adds triangles in the existing topology, given face indecies must be free;
258// 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
265
266// adds triangles in the existing topology, auto selecting face ids for them;
267// 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
273
283
288
292
297
302
306
311
316
320
325
330
334
339
344
348
353
358
362
367
371
376
379MRC_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);
380
383
386
391
394
397
403
413MRC_API int MR_MeshBuilder_uniteCloseVertices_4(MR_Mesh *mesh, float closeDist, const bool *uniteOnlyBd, MR_VertMap *optionalVertOldToNew);
414
423
424#ifdef __cplusplus
425} // extern "C"
426#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_FaceBitSet MR_FaceBitSet
Definition MRAABBTreeBase.h:24
struct MR_VertBitSet MR_VertBitSet
Definition MRAABBTree.h:15
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:12
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)
Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the...
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)
Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the...
struct MR_MeshBuilder_MeshPiece MR_MeshBuilder_MeshPiece
Generated from class MR::MeshBuilder::MeshPiece.
Definition MRMeshBuilder.h:35
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
Generated from class MR::MeshBuilder::UniteCloseParams.
Definition MRMeshBuilder.h:38
MRC_API MR_MeshBuilder_UniteCloseParams * MR_MeshBuilder_UniteCloseParams_OffsetMutablePtr(MR_MeshBuilder_UniteCloseParams *ptr, ptrdiff_t i)
Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the...
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)
Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the...
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
Generated from class MR::MeshBuilder::VertDuplication.
Definition MRMeshBuilder.h:31
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)
Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the...
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)
Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the...
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
MR_PassBy
Definition common.h:19
uint64_t MR_uint64_t
Definition common.h:14
#define MRC_API
Definition exports.h:11
Definition MRId.h:55