-
Hi! auto loadRes1 = MeshLoad::fromAnySupportedFormat("A.stl");
auto loadRes2 = MeshLoad::fromAnySupportedFormat("B.stl");
Mesh SplintMesh = loadRes1.has_value() ? loadRes1.value() : Mesh();
Mesh PartMesh = loadRes2.has_value() ? loadRes2.value() : Mesh();
int VertNum = int(SplintMesh.topology.numValidVerts());
int faceNum = int(SplintMesh.topology.numValidFaces());
std::cout << "ori: " << VertNum << " " << faceNum << std::endl;
Triangulation PartTris = PartMesh.topology.getTriangulation();
MeshBuilder::BuildSettings buildSettings;
buildSettings.shiftFaceId = SplintMesh.topology.numValidFaces();
MeshBuilder::addTriangles(SplintMesh.topology, PartTris, buildSettings);
VertNum = int(SplintMesh.topology.numValidVerts());
faceNum = int(SplintMesh.topology.numValidFaces());
std::cout << "new: " << VertNum << " " << faceNum << std::endl; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello!
Something like this should work if boundary vertices of two meshes are the same auto loadRes1 = MeshLoad::fromAnySupportedFormat("A.stl");
auto loadRes2 = MeshLoad::fromAnySupportedFormat("B.stl");
Mesh SplintMesh = loadRes1.has_value() ? loadRes1.value() : Mesh();
Mesh PartMesh = loadRes2.has_value() ? loadRes2.value() : Mesh();
SplintMesh.addMesh( PartMesh );
MeshBuilder::uniteCloseVertices( SplintMesh, 0.0f, true ); // this function should merge boundary vertices with same coordinates |
Beta Was this translation helpful? Give feedback.
Hello!
MeshBuilder::addTriangles
should work when vertices of two meshes are already indexed correctly: meaning that "duplicated" vertices have same indices in "SplintMesh" and in "PartMesh" topologies, but it actually cannot be guaranteed within stl format.Something like this should work if boundary vertices of two meshes are the same