Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Smooth surfaces at image boundary

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Smooth surfaces at image boundary


Chronological Thread 
  • From:
  • To:
  • Subject: Re: [cgal-discuss] Smooth surfaces at image boundary
  • Date: Mon, 9 May 2022 10:43:50 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-data: A9a23:YNeCO6OaTn6Eym7vrR3AkcFynXyQoLVcMsEvi/4bfWQNrUorgj0Dz DAbCGCCMq3eYmf9LdogYYuzpkIBscPTnd9jQHM5pCpnJ55ogZqcVI7Bdi8cHAvLc5adFBo/h yk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EsLd9IR2NYy24DkW1PV4 7senuWGULOb824sWo4rw/nbwP9flKyaVOQw4zTSzdgS1LPvvyF94KA3fcldHFOkKmVgJdNWc s6YpF2PEsw1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXe345jXMfwZ3u7hB2OuY1yy vptm6bvblwEOo7MnfwicytHRnQW0a1uoNcrIFC6sMCcxlfKNWHhxOUoBV1e0Y8wo7kpRzAIq qxecWtVBvyAr7reLLaTSuRogsMLNsTsLMUWphmMyBmAVqt9EMmaE80m4/d7zQZhuYNBFs3Qd swQN2RFMEn+WT52bwJ/5JUWx7712SKkKFW0smm9rqU+5y3fzRd6zaP2GMHEf8SDA8RThEeR4 Gzcl1kVGTkfNdCQwCCJtGihgf+JlD+TtJ8u+KOQ8dg3g1+85kIpVzpNeF+YofyhtW6MRIcKQ 6ALwRYGoa83/U2ta9DyWRykvXKJ1iLwvfIASoXWDyndkMLpDxal6nssE2cbOY193CMibW12h wbR9z/8LWY36NWopWShGqC8gR7aBMT4BWoDaSANVwdD+dTksMc6knojr+qP8obp17UZ+hmpk 1hmSRTSYJ1J1KY2O12Tpwyvvt5VjsGhovQJzgvWRHm5yQhyeZSoYYelgX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5G5uM+ZnJDZvqWiWnK9A9dNJDLzw9rI9yLzpmh6SVi2m/T58jH+OS491yKzl9xjV CGT6Q35fpGuzKOid+RuYkhvAlb4rct8AIB31IUq1tkW3jABi5OZ8GBi8y+7OMhH2a/4cHsGR CIai9/T7g//3UR/L3WPj4vnX3SZy8FlapG0eGQTki466slLDu+T4tkm1WNtpUGkqAvKffVnt jIcxfQn8nJcmewOqEwk0mTVA7wfG1VZIT25lxmM6IPbzu0fb2KufL6skUtmyIn+UvfT5F4MH i+iIsRHf2c49Mh0PVPS3Wem74jlfIKVdtcPrliPlA+GieFJKZU3n/5MhCx9OGu7s2d2roxzx RFow5y+u5CKbmt3+6fsSB5VMjnyT9ke/SGrhLoUzaP0l8i/W45sHDkGRs6iVfWzDDcbrujqL S6LETEzo22XX6DSGh/Z4Vss/BetW9i7cnqQInce19BrQhKQcVdejA4jVzI/hpclFwquyaQJk W985zwe70T07AFBzfIuPgWtCg83QS+yZzAkDpGDfkI+Bu5q/UrSIYqX8rAqdxw=
  • Ironport-sdr: QZ9tYMxbVfou0sqDZ0qORy8Q82sofXycWYW3htcOTIA2HhX+GeXWdnVvDy3NzantWRyoThYjmJ H+E/KN9ktqZijL6sKYYOf3GqFiwW3UDQvjWjV33jCTgK4LMINqmLspYRqjLdr/M3OG+MdfoJL0 TPxm9I/X7yObi1YHSaZGUWt4qc+54eb+rnozD7TSlYd7o8gNUzt0K/JpSTp91rlP0W8aERPr7y jwpQkClgG9GjwgSeju1NvBm39scVQw0nGoU9qy6kL6/yrSc2sqVX4ib7KycuuigJXERDHvWyGk Srco2Xd7iHRGig+yyyvUJ0Nx

Hello,

sure! Attached is an example source code and the resulting file for the 420 example.

I would have expected, that all nodes on the bounding surfaces are either at x/y/z 0 or 100 (as it is for the edges) but instead they appear roughly at 0 or 100 +-0.05.
It seems to correlate with the relative_error_bound, however I can only make the error smaller but not go away completely. (The attached file is generated with 1e-3)

Best,
Sebastian


On 09.05.22 09:23, Sebastien Loriot ( via cgal-discuss Mailing List) wrote:
Hello,

could you share a minimal example showing the problem?

Thanks,

Sebastien.

On 5/7/22 13:37, Sebastian Bachmann ( via cgal-discuss Mailing List) wrote:
Hello,
No one has an idea? Is it not somehow possible to restrict nodes onto a surface? I.e. if I have the polyline of the surface's boundary, can I specify that all nodes must be on that surface?

For now I have written a function to go over all nodes and check if they are near such a boundary face and then "pull" the nodes onto that surface. However, there are certain edge cases were this then yields collapsed triangles etc. Thus, solving this during meshing would be a great enhancement.

Best,
Sebastian

On 25.04.2022 07:16, Sebastian Bachmann ( via cgal-discuss Mailing List) wrote:
Hello,

I created an image meshing tool, similar to the one given here in this example code: https://doc.cgal.org/latest/Mesh_3/Mesh_3_2mesh_3D_image_with_features_8cpp-example.html with the only difference, that I extract the surface elements and not write the full 3D mesh.
I noticed, that on the image boundary, the vertices would be not exactly on the face but roughly +- the relative error bound given in create_labeled_image_mesh_domain. For examples, nodes on the xy plane at z=0 are not on z=0 but for example -0.01 to 0.01. While the protected polylines are exact and have always z=0.
I created for example a mesh from the 420.inr example with the same meshing criteria as given in the example and can see that behaviour there.

While you can control the maximal deviation using the relative error bound, there will always be some deviation. And if I set the relative error bound too low, it seems the meshing never finishes.
I wonder now, if it is possible to constraint the mesh (similar to the 1d polylines), such that the vertices for facets on the image boundary, are always exactly on the image boundary?

Best,
Sebastian


#include <vector>
#include <iostream>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/Image_3.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_domain_with_polyline_features_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Labeled_mesh_domain_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Labeled_mesh_domain_3<K> Image_domain;
typedef CGAL::Mesh_domain_with_polyline_features_3<Image_domain> 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> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;

typedef K::Point_3 Point_3;
typedef unsigned char Word_type;

using namespace CGAL::parameters;
#include <CGAL/Mesh_3/polylines_to_protect.h> // undocumented header

int main(int argc, char* argv[])
{
  const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/420.inr");
  // Loads image
  CGAL::Image_3 image;
  if(!image.read(fname)){
    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
    return EXIT_FAILURE;
  }
  // Domain
  double tol = (argc>2)?std::stod(argv[2]):1e-3;
  Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, relative_error_bound=tol);
  std::vector<std::vector<Point_3> > polylines_on_bbox;
  CGAL::polylines_to_protect<Point_3, Word_type>(image, polylines_on_bbox);
  domain.add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());


  Mesh_criteria criteria(edge_size=6,
                         facet_angle=30, facet_size=6, facet_distance=4,
                         cell_radius_edge_ratio=3, cell_size=8);
  // Meshing
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);

  // Extract surface
  CGAL::Polyhedron_3<K> poly;
  CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, poly);

  std::ofstream mout("420_surface.off");
  mout << poly;
  mout.close();

  return 0;
}

Attachment: 420_surface.off
Description: object/oogl




Archive powered by MHonArc 2.6.19+.

Top of Page