Skip to content

How to Remove Duplicate Vertices When Merging Two Meshes #4551

Answered by Grantim
Irovel asked this question in Q&A
Discussion options

You must be logged in to vote

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

    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, t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Irovel
Comment options

Answer selected by Irovel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants