Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Holes in mesh

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Holes in mesh


Chronological Thread 
  • From: "Laurent Rineau (CGAL/GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Holes in mesh
  • Date: Tue, 22 May 2018 14:29:13 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:utjsOxfZ93Qnhj7k4lC5WIK0lGMj4u6mDksu8pMizoh2WeGdxcW6Yx7h7PlgxGXEQZ/co6odzbaO6Oa4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahb75+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM38H/ZhNF+gqxYpxKupRJ/zIHIb4+aL/d+e77TcMkASGZdQspdSipMCZ68YYsVCOoBOP5Vo4f7qVQUsBu+HxejBOXzyjRVmnH23Ks63Po7HgHbwQcsG8wDvnXIodvzL6scUP66zK7NzTrdc/NWwzf85ojSfR89vfGMWqhwcMrUxUUhCgjIiVGQppb4PzOPyOsNtXSb4/B6VeKujW4otRt+oiW0y8gwhYnGnIYVxkrD9SVjz4Y4PNu1Q1N1b96jFZtfrSCaN41uT8w+TGFnoiI6xqcBuZ6hcygG0JsnyADYa/yCbYeI/gjjVeafIThimH1lZLW/hwyy8ES61uL8Ucy03VBXpSRGitnBrn8A2h3J5sSaVvdw/l2t1DmL2gzJ9+1JI104mbLfJpI92LI9lZsevV7HEyPrgkn6krGaelsi9+O18eroeK/mqYWZN4JsigHxLKAumsunDOk3KAQOWm+b9fm+2bDg50H5Ra9FjvwykqXAt5DaONgbqrS+Aw9L0oYv8RC/ACm60NgAnHkHKkxKeA6fgoXmOlzCOu30Aeu/jli2nzpmw+rKMqDjD5nQNnTDla3ufbd5605S0gozytVf6opQCr4bPfLzQFH+tNrEDhMjKQy0wuDnB8tn2YMDQm+AHqCZP7nWsVOS4eIvOeaMaJcPuDnhM/gl++LujXghlFABcqmmx58XZGmlEfRnOEWWfWfsgswaEWoRpQo/TOnqiEWYXjJJZnayWbg85jAhB468A4fDXNPlvLvU1yiyGthaZ3tNF0uXOXbubYSNHfkWOwyIJco02BgNSKKsTZNp7xCouQbng/pMAcPwvQIVspfuyMJkyeTYiRYo5H0+R5CZ2nyXQmdo2HkJQTI/wYh0rkV5jFCZ3v4r0LRjCdVP6qYRAU8BPpnGwrkiUoGgakf6Zt6MDW2ebJCjCDA1QMg2xoZWMU1yEtHkiQrMjXPzX+0l0oeTDZlxyZrymmDrLp8lmX3J3a1niEMpEJMWaD+Ww5Vn/g2WPLbn1kWUk6HwK/ZAmivKrTjTi2+HvUUdVxNsF6LbXTYZa1eE9dk=
  • Organization: GeometryFactory

Le Monday, May 21, 2018 6:33:00 PM CEST Gabriel Balaban a écrit :

> Dear CGAL people,

>

> I modified the demo mesh_polyhedral complex to make a mesh within a mesh,

> but I seem to be getting holes in the outside mesh for some reason. Could

> you please help me out?

>

> The file holes_in_mesh.png is a screenshot from paraview of the resulting

> mesh,

> and make_mesh.cpp is the c++ program that makes the mesh.

> The outer two files are the inner and outer mesh.

>

> I am aware that for cubes it would be easier to use geometric predicates,

> but I would like to extend the meshing to more complicated meshes so that

> is why my simple test case has surface meshes.

>

> Cheers,

> Gabriel

 

Your construction of the mesh domain is strange: `inner_off` is used twice, with different incidences. If you remove the first occurrence of it, the produced mesh is fine. I attached the modified version I had used.

 

--

Laurent Rineau, PhD

R&D Engineer at GeometryFactory http://www.geometryfactory.com/

Release Manager of the CGAL Project http://www.cgal.org/

 

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>

#include <CGAL/Polyhedral_complex_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>

#include <cstdlib>

// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
typedef CGAL::Polyhedral_complex_mesh_domain_3<K> Mesh_domain;


#ifdef CGAL_CONCURRENT_MESH_3
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif

// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;

typedef CGAL::Mesh_complex_3_in_triangulation_3<
  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_index> C3t3;

// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;

// To avoid verbose function and named parameters call
using namespace CGAL::parameters;

const char* const filenames[] = {
  // "inner_cube.off",
  "inner_cube.off",
  "outer_cube.off"
};

const std::pair<int, int> incident_subdomains[] = {
  // std::make_pair(0, 1),
  std::make_pair(1, 2),
  std::make_pair(0, 2),
};

int main()
{
  const std::size_t nb_patches = sizeof(filenames) / sizeof(const char*);
  CGAL_assertion(sizeof(incident_subdomains) ==
                 nb_patches * sizeof(std::pair<int, int>));
  std::vector<Polyhedron> patches(nb_patches);
  for(std::size_t i = 0; i < nb_patches; ++i) {
    std::ifstream input(filenames[i]);
    if(!(input >> patches[i])) {
      std::cerr << "Error reading " << filenames[i] << " as a polyhedron!\n";
      return EXIT_FAILURE;
    }
  }
  // Create domain
  Mesh_domain domain(patches.begin(), patches.end(),
                     incident_subdomains,
                      incident_subdomains+nb_patches);

  domain.detect_features(); //includes detection of borders

  // Mesh criteria
  // facet_angle = 25,
  // facet_distance = 0.3,
  // cell_radius_edge_ratio = 3,
  // facet_size = 0.3,
  // edge_size = 0.3,

  Mesh_criteria criteria(cell_size = 0.3);

  // Mesh generation
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);

  // Output
  std::ofstream medit_file("out.mesh");
  c3t3.output_to_medit(medit_file);

  return EXIT_SUCCESS;
}



Archive powered by MHonArc 2.6.18.

Top of Page