cutdigital / mcut

A library for detecting and resolving intersections between two surface meshes.
https://cutdigital.github.io/mcut.site
Other
414 stars 76 forks source link

Intersection two obj model crash !!! #5

Closed breakerrorchen closed 2 years ago

breakerrorchen commented 2 years ago

``Hello, I am looking for a robust Boolean library, I found it is a good choice, but there are some problems. For example, when I Intersection the next two OBJ's, crash occurs.

Assertion failed: 3rd/mcut/source/kernel.cpp, 3567 at '(int)intersection_test_ivtx_list.size() >= 2'

McutMesh mesh_src; mesh_src.Load(src);
    McutMesh mesh_cut; mesh_cut.Load(cut);
    if (!mesh_src.Available() || !mesh_cut.Available()) {
        return nullptr;
    }
    const McFlags Flags = MC_DISPATCH_FILTER_FRAGMENT_SEALING_INSIDE | MC_DISPATCH_FILTER_FRAGMENT_LOCATION_BELOW;
    auto dispatch_ret = ::mcDispatch(
        context_, 
        MC_DISPATCH_VERTEX_ARRAY_FLOAT | MC_DISPATCH_ENFORCE_GENERAL_POSITION | Flags,
        &(mesh_src.vertices_[0]), 
        &(mesh_src.face_indices_[0]), 
        &(mesh_src.face_sizes_[0]), 
        (uint32_t)(mesh_src.vertices_.size() / 3), 
        (uint32_t)mesh_src.face_sizes_.size(),
        &(mesh_cut.vertices_[0]), 
        &(mesh_cut.face_indices_[0]), 
        &(mesh_cut.face_sizes_[0]), 
        (uint32_t)(mesh_cut.vertices_.size() / 3), 
        (uint32_t)mesh_cut.face_sizes_.size());
    if (MC_NO_ERROR != dispatch_ret) {
        is_error_ = true;
        return nullptr;
    }

data.zip