11#pragma once
22
3- #include " MRMeshFwd.h"
4- #include " MRId.h"
5- #include " MRMeshTopology.h"
6- #include " MRVector.h"
7- #include < vector>
3+ #include " MRMeshBuilderTypes.h"
4+ #include " MRMesh.h"
85
96namespace MR
107{
@@ -34,20 +31,7 @@ namespace MR
3431namespace MeshBuilder
3532{
3633
37- struct Triangle
38- {
39- Triangle () noexcept = default ;
40- Triangle ( VertId a, VertId b, VertId c, FaceId f ) : f(f) { v[0 ] = a; v[1 ] = b; v[2 ] = c; }
41- VertId v[3 ];
42- FaceId f;
43-
44- bool operator ==( const Triangle& other )const
45- {
46- return f == other.f && v[0 ] == other.v [0 ] && v[1 ] == other.v [1 ] && v[2 ] == other.v [2 ];
47- }
48- };
49-
50- // construct mesh from a set of triangles with given ids;
34+ // construct mesh topology from a set of triangles with given ids;
5135// if skippedTris is given then it receives all input triangles not added in the resulting topology
5236MRMESH_API MeshTopology fromTriangles ( const std::vector<Triangle> & tris, std::vector<Triangle> * skippedTris = nullptr );
5337
@@ -62,15 +46,19 @@ struct VertDuplication
6246MRMESH_API size_t duplicateNonManifoldVertices ( std::vector<Triangle>& tris,
6347 std::vector<VertDuplication>* dups = nullptr );
6448
65- // construct mesh from a set of triangles with given ids;
49+ // construct mesh topology from a set of triangles with given ids;
6650// unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices
6751MRMESH_API MeshTopology fromTrianglesDuplicatingNonManifoldVertices ( const std::vector<Triangle> & tris,
6852 std::vector<VertDuplication> * dups = nullptr ,
6953 std::vector<Triangle> * skippedTris = nullptr );
7054
71- // construct mesh from vertex-index triples
55+ // construct mesh topology from vertex-index triples
7256MRMESH_API MeshTopology fromVertexTriples ( const std::vector<VertId> & vertTriples );
7357
58+ // construct mesh from point triples;
59+ // all coinciding points are given the same VertId in the result
60+ MRMESH_API Mesh fromPointTriples ( const std::vector<ThreePoints> & posTriples );
61+
7462// a part of a whole mesh to be constructed
7563struct MeshPiece
7664{
@@ -80,7 +68,7 @@ struct MeshPiece
8068 std::vector<Triangle> tris; // remaining triangles, not in topology
8169};
8270
83- // construct mesh in parallel from given disjoint mesh pieces (which do not have any shared vertex)
71+ // construct mesh topology in parallel from given disjoint mesh pieces (which do not have any shared vertex)
8472// and some additional triangles that join the pieces
8573MRMESH_API MeshTopology fromDisjointMeshPieces ( const std::vector<MeshPiece> & pieces, VertId maxVertId, FaceId maxFaceId,
8674 std::vector<Triangle> & borderTris ); // < on output borderTris will contain not added triangles
@@ -102,7 +90,7 @@ struct FaceRecord
10290 int lastVertex = 0 ;
10391};
10492
105- // construct mesh from face soup, where each face can have arbitrary degree (not only triangles)
93+ // construct mesh topology from face soup, where each face can have arbitrary degree (not only triangles)
10694MRMESH_API MeshTopology fromFaceSoup ( const std::vector<VertId> & verts, std::vector<FaceRecord> & faces );
10795
10896} // namespace MeshBuilder
0 commit comments