Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

params::vertex_is_constrained_map setting in PMP::isotropic_remeshing does not set the corner points remain its position during remesh #8388

Closed
citystrawman opened this issue Aug 5, 2024 · 5 comments
Assignees
Labels

Comments

@citystrawman
Copy link

citystrawman commented Aug 5, 2024

Please use the following template to help us solving your issue.

Issue Details

I am using PMP::isotropic_remeshing method to remesh a surface mesh. I have a vertex_is_constrained_map in which the corner points are set to be true.

Before isotropic_remeshing, the surface mesh is as follows:
image

and the green points are corner points (for these vertices, vertex_is_constrained_map[vertex] = true )

However, after isotropic_remeshing, the corner points are not at the same position, which is not what I desire:
image
image

I use isotropic_remeshing to another example but that example works fine: the corner points all remains at its position:
image
I dont understand why the two isotropic_remeshing (I implement the two almost the same) results differently.

Source Code

//only part of the code is shown, because the code is a little long.

    std::vector<face_descriptor> sp_selected_faces;
    std::vector<bool> sp_is_selected(num_faces(mesh2_clip), false);
    for (edge_descriptor e : edges(mesh2_clip))
        if (sp_constrained_map[e])
        {
            // insert all faces incident to the target vertex
            for (halfedge_descriptor h : halfedges_around_target(halfedge(e, mesh2_clip), mesh2_clip))
            {
                if (!is_border(h, mesh2_clip))
                {
                    face_descriptor f = face(h, mesh2_clip);
                    if (!sp_is_selected[f])
                    {
                        sp_selected_faces.push_back(f);
                        sp_is_selected[f] = true;
                    }
                }
            }
        }
// increase the face selection
CGAL::expand_face_selection(sp_selected_faces, mesh2_clip, 2,
    Vector_pmap_wrapper(sp_is_selected), std::back_inserter(sp_selected_faces));

std::cout << sp_selected_faces.size()
    << " faces were selected for the remeshing step\n";


Mesh::Property_map<vertex_descriptor, bool> vertex_is_constrained_split =
    mesh2_clip.add_property_map<vertex_descriptor, bool>("v:is_constrained", false).first;

for each (vertex_descriptor v in v_constrained_vec_split)
{
    vertex_is_constrained_split[v] = true;
}

PMP::isotropic_remeshing(sp_selected_faces, target_edge_length, mesh2_clip, params::vertex_is_constrained_map(vertex_is_constrained_split));

mesh2_clip.collect_garbage();

CGAL::draw(mesh2_clip);

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits):
  • Compiler:
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version:
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):
@janetournois janetournois self-assigned this Aug 5, 2024
@citystrawman
Copy link
Author

Hi @janetournois , I saw you have assigned this issue. Do you need the code and input files?

@janetournois
Copy link
Member

Hello @citystrawman
indeed the piece of code you sent is not enough to understand what's wrong in your code. I would need a standalone and the data to understand why vertex_is_constrained_map is not working

@citystrawman
Copy link
Author

citystrawman commented Aug 6, 2024

Hello @citystrawman indeed the piece of code you sent is not enough to understand what's wrong in your code. I would need a standalone and the data to understand why vertex_is_constrained_map is not working

Here's the code:
clip_get_intersect_points_new_try_remove2.zip

Here's the input off model:
model.zip

Because this code is my testing code, it is a bit long and has many intermediate processes, but you can find that I write out "slope_clip_before.off" and "slope_clip.off" which corresponds to the screenshot that I have shown, these two outputs are example that vertex_is_constrained_map is not working. You can also find "slide_clip_before.off" and "slide_clip.off" , and these two outputs are example that vertex_is_constrained_map working fine.

If you have anything unclear, feel free to call me. Thank you!

@citystrawman
Copy link
Author

Hello @citystrawman indeed the piece of code you sent is not enough to understand what's wrong in your code. I would need a standalone and the data to understand why vertex_is_constrained_map is not working

BTW I use 5.5.x version

@janetournois
Copy link
Member

I'm not sure what is wrong in your code. You should try to make a shorter test to make sure your feature vertices are kept by remeshing (the constraints code works in our tests).

As a short term workaround, I would suggest to use edge_is_constrained_map (I saw you already have the set of constrained edges available), and to set protect_constraints to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants