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

sharp edge segmentation not working with geometrical primitives like cube, cylinder and cone #7903

Closed
shomeAvataar opened this issue Dec 4, 2023 · 3 comments

Comments

@shomeAvataar
Copy link

shomeAvataar commented Dec 4, 2023

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

Issue Details

(sharp edge segmentation example) gives unexpected behavior with geometric primitives such as cube, cylinder, cone. All the meshes are triangulated meshes.

With all the primitives (cube, cylinder, cone) and with varying angles (30, 60, 90 degrees) the output is the same:

This mesh contains 0 sharp edges and 1 surface patches.

Basically the segmentation using sharp feature does not seem to work.

Source Code

The source code is a minor modification of the CGAL example titled Polygon_mesh_processing/detect_features_example.cpp

How to run: ./main mesh.off angle_bound(in degrees)

Geomteric primitives attached in zip file.

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>

#include <CGAL/Polygon_mesh_processing/detect_features.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>

#include <iostream>
#include <string>
#include <cstdlib>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3>                      Mesh;
typedef boost::graph_traits<Mesh>::face_descriptor          face_descriptor;

namespace PMP = CGAL::Polygon_mesh_processing;

int main(int argc, char* argv[])
{
  const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/P.off");
  
  float angle_bound = atof(argv[2]);
  
  Mesh mesh;
  if(!PMP::IO::read_polygon_mesh(filename, mesh))
  {
    std::cerr << "Invalid input." << std::endl;
    return 1;
  }

  typedef boost::property_map<Mesh, CGAL::edge_is_feature_t>::type EIFMap;
  typedef boost::property_map<Mesh, CGAL::face_patch_id_t<int> >::type PIMap;
  typedef boost::property_map<Mesh, CGAL::vertex_incident_patches_t<int> >::type VIMap;

  EIFMap eif = get(CGAL::edge_is_feature, mesh);
  PIMap pid = get(CGAL::face_patch_id_t<int>(), mesh);
  VIMap vip = get(CGAL::vertex_incident_patches_t<int>(), mesh);

  std::size_t number_of_patches
    = PMP::sharp_edges_segmentation(mesh, angle_bound, eif, pid,
                                    CGAL::parameters::vertex_incident_patches_map(vip));

  std::size_t nb_sharp_edges = 0;
  for(boost::graph_traits<Mesh>::edge_descriptor e : edges(mesh))
  {
    if(get(eif, e))
      ++nb_sharp_edges;
  }

  std::cout << "This mesh contains " << nb_sharp_edges << " sharp edges" << std::endl;
  std::cout << " and " << number_of_patches << " surface patches." << std::endl;

  return 0;
}

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): ubuntu 20.04.6 LTS

  • Compiler: g++ 9.4

  • Release or debug mode: Release

  • Specific flags used (if any):

  • CGAL version: 5.6

  • Boost version: 1.71
    primitives.zip

  • Other libraries versions if used (Eigen, TBB, etc.):

@PAAR16
Copy link

PAAR16 commented Dec 8, 2023

hey i am new to open source and dont know much about it but i am pretty good in c++ , would you be kind enough to tell me exactly what the issue needs resolving is it either the code or something in which i can help with

@kannishk
Copy link

Can I be assigned this? @afabri @MaelRL

@sloriot
Copy link
Member

sloriot commented Jan 15, 2024

There is nothing sharp in your models, edges are rounded.
Screenshot from 2024-01-15 09-37-48

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

No branches or pull requests

5 participants