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#include <stdint.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15typedef struct MR_FaceBitSet MR_FaceBitSet; // Defined in `#include <MRCMesh/MRBitSet.h>`.
16typedef struct MR_FaceMap MR_FaceMap; // Defined in `#include <MRCMesh/MRVector.h>`.
17typedef struct MR_Mesh MR_Mesh; // Defined in `#include <MRCMesh/MRMesh.h>`.
18typedef struct MR_MeshBuilder_BuildSettings MR_MeshBuilder_BuildSettings; // Defined in `#include <MRCMesh/MRMeshBuilderTypes.h>`.
19typedef struct MR_MeshTopology MR_MeshTopology; // Defined in `#include <MRCMesh/MRMeshTopology.h>`.
20typedef struct MR_Triangulation MR_Triangulation; // Defined in `#include <MRCMesh/MRVector.h>`.
21typedef struct MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId MR_Vector_MR_MeshBuilder_VertSpan_MR_FaceId; // Defined in `#include <MRCMesh/MRVector.h>`.
22typedef struct MR_VertBitSet MR_VertBitSet; // Defined in `#include <MRCMesh/MRBitSet.h>`.
23typedef struct MR_VertMap MR_VertMap; // Defined in `#include <MRCMesh/MRVector.h>`.
24typedef struct MR_std_function_bool_from_float MR_std_function_bool_from_float; // Defined in `#include <MRCMisc/std_function_bool_from_float.h>`.
25typedef struct MR_std_vector_MR_MeshBuilder_MeshPiece MR_std_vector_MR_MeshBuilder_MeshPiece; // Defined in `#include <MRCMisc/std_vector_MR_MeshBuilder_MeshPiece.h>`.
26typedef struct MR_std_vector_MR_MeshBuilder_VertDuplication MR_std_vector_MR_MeshBuilder_VertDuplication; // Defined in `#include <MRCMisc/std_vector_MR_MeshBuilder_VertDuplication.h>`.
27typedef struct MR_std_vector_MR_VertId MR_std_vector_MR_VertId; // Defined in `#include <MRCMisc/std_vector_MR_VertId.h>`.
28typedef 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>`.
29
30
33
34// a part of a whole mesh to be constructed
37
40
50
51// original vertex before duplication
56
57// original vertex before duplication
61
62// original vertex before duplication
67
68// new vertex after duplication
73
74// new vertex after duplication
78
79// new vertex after duplication
84
88
93
97
100
103
108
111
114
120
121// resolve non-manifold vertices by creating duplicate vertices in the triangulation (which is modified)
122// `lastValidVert` is needed if `region` or `t` does not contain full mesh, then first duplicated vertex will have `lastValidVert+1` index
123// return number of duplicated vertices
130
131// construct mesh topology from a set of triangles with given ids;
132// unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices;
133// triangulation is modified to introduce duplicates
141
142// construct mesh from point triples;
143// all coinciding points are given the same VertId in the result
148
149// face of part -> face of whole mesh
154
155// face of part -> face of whole mesh
159
160// face of part -> face of whole mesh
165
166// vert of part -> vert of whole mesh
171
172// vert of part -> vert of whole mesh
176
177// vert of part -> vert of whole mesh
182
187
191
196
197// remaining triangles of part, not in topology
202
203// remaining triangles of part, not in topology
207
208// remaining triangles of part, not in topology
213
217
222
226
229
232
236
239
242
247
248// construct mesh topology in parallel from given disjoint mesh pieces (which do not have any shared vertex)
249// and some additional triangles (in settings) that join the pieces
257
258// adds triangles in the existing topology, given face indecies must be free;
259// 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
266
267// adds triangles in the existing topology, auto selecting face ids for them;
268// 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
274
284
289
293
298
303
307
312
317
321
326
331
335
340
345
349
354
359
363
368
372
377
380MRC_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);
381
384
387
392
395
398
404
414MRC_API int32_t MR_MeshBuilder_uniteCloseVertices_4(MR_Mesh *mesh, float closeDist, const bool *uniteOnlyBd, MR_VertMap *optionalVertOldToNew);
415
424
425#ifdef __cplusplus
426} // extern "C"
427#endif
struct MR_MeshTopology MR_MeshTopology
Definition MR2DContoursTriangulation.h:16
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:25
struct MR_VertBitSet MR_VertBitSet
Definition MRAABBTree.h:15
struct MR_VertMap MR_VertMap
Definition MRBitSet.h:41
struct MR_FaceMap MR_FaceMap
Definition MRBitSet.h:27
struct MR_Mesh MR_Mesh
Definition MRCtm.h:13
struct MR_std_vector_MR_VertId MR_std_vector_MR_VertId
Definition MREdgePaths.h:30
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 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:25
MRC_API int32_t MR_MeshBuilder_uniteCloseVertices_4(MR_Mesh *mesh, float closeDist, const bool *uniteOnlyBd, MR_VertMap *optionalVertOldToNew)
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 int32_t MR_MeshBuilder_uniteCloseVertices_2(MR_Mesh *mesh, const MR_MeshBuilder_UniteCloseParams *params)
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:36
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 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:39
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: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)
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:56