Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Help with make_surface_mesh

Subject: CGAL users discussion list

List archive

[cgal-discuss] Help with make_surface_mesh


Chronological Thread 
  • From: Tony Apicella <>
  • To: "" <>
  • Subject: [cgal-discuss] Help with make_surface_mesh
  • Date: Mon, 4 Jan 2021 16:42:33 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epmap-system.com; dmarc=pass action=none header.from=epmap-system.com; dkim=pass header.d=epmap-system.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3qyHwAEQ8laqPtK4UYbOG9hPdJLNX0hnvI3tk8U3XVc=; b=WRP68cgxw0cpPSeTMbROk228eKuv5L6ZGhEQGTdc2/zQfrzFNUZNpc3i4koI528Fvyl+3e7T55fqc37xrE1JZy2MNXlmoRV9obIB4KvFH2/ryUMSKhVlwt9QKGr+tZ5weYI+FiRwbg6IjPhzY2sju69mpdT8rsBJnam4x90s/PCF4wKF/GmFa6BsyFkmaEzQ5oBOBfEDxd+lmMZkW9tlqeTED/j0eAK2Q6JUznkPv3WWs+uVHESroexZOzCvSGjMh2ttocaV1mJUUJSKvPJem5VP+u+WPglrcyf2YI0NeWE12E0bi8eCmmCFyYLLzAyta6lPggglQqYz2NchfZ8aiA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kHErp0TRfmwLLNANz1CESIoTuJtJr/8yardinzDfibouOo6EgGTRncq4QCrYlhcJEiRrPqr1+HthTDUQsvAPpIuHTZjFuS1v5AcKKYLeA52n2nrRTHuA9PEMVAJFnCrgLL77zhxV39R/x89bJdBuo15oDaqnjL6Srr1jP6n1nvcHY2aYr+txfy97G6Qyw73bm4ALLRly2qCNq7sVxxfdaoSh7dIX+qvWR0K6ggz9uIqKq1/sDEOZCPh4pxzUmi4+MHgXYCRHnCSK6GZbdI4yu4/ScMinccsymJbubj4frrz52EGvpeTXzemBNIHtm2QO2zLFGK96eRPFjWbsxbvMXA==
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
  • Ironport-phdr: 9a23:nZF8dxa6jS9IFOOVoLWp8PP/LSx+4OfEezUN459isYplN5qZpsy+YR7h7PlgxGXEQZ/co6odzbaP7Oa6AjdLsc/JmUtBWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6OPn+FJLMgMSrzeCy/IDYbxlViDanbr5+MRe7oR/PusQYj4ZuJaU8xgbUqXZUZupawn9lK0iOlBjm/Mew+5Bj8yVUu/0/8sNLTLv3caclQ7FGFToqK2866tHluhnFVguP+2ATUn4KnRpSAgjK9w/1U5HsuSbnrOV92S2aPcrrTbAoXDmp8qlmRAP0hCoBKjU09nzchM5tg6JBuB+vpwJxzZPIYI+bN/R+cKHSfdIGSmVORctRUjBNDp+mYocTE+YNIOBVpJT9qVsUqhu+ABGhCv3oyj9Ohn79wLE30/wgEQ7awgMgG9YOv27Jp9jyKKcSVua1zanSwjXbbvNZxSny6IzMch87uvyDQ6pwcc/Lxkk3Dg/FlVWRqZf5PzyL0+QBqXSU7+1lVe+2jWMstg5+rCS1yMg2lonJmpwaykrC9Shh3Ys7KtK2RVJ7b9K4DJZdtS+UOoV4T88+Xm1lvDg3xqAbtZKmYSUEx5QpyhDcZvGGboSF4R3tWfueLDp8hX9rdrSyjAux/0i40uDxWdW43ExXoiZZkNTArG0B2hLT58SdS/Zw/F+t1SiO2gzP9+1JJEE5mKXZJpMkwrM/iJkevVjGEyDsmkj5kLOae0Ag9+S09uvqYrDrqYKfOoJ2lA7zN6Ujlde9DOgkNwUDXGmW9Oe82bH740H0QalGg/Mzn6XErJzVP8UWq6uiDANIzoou7hayAjKj3dgFnXQKKk9OdgidgIjzIV7OJej1DfehjFSolzdm3/7IMLLvDZnRM3TPibfvc6pj50JFzwo81s5Q64hTCrEcPPL8QUjxtMHeDhAkKQC02/znCNJh1owARW2PHq6ZMKTUsVOS4eIvPvWMZIsSuDb6KPgp/eLhjXg8mVMFfKmp24UYaGygE/lpP0mVe2fgjssDHGsQowYzQuznhEeDXDNRf3qyWrgz5jA/CIKoF4fDQYWtjaSd3Ce8GJ1XZnpJCkiNEXj0aYqEX/MMZziJL8B/ijwEUKKuS5c42RG1tA760KZnIfTR+iECqZ3j09116/XJlR4u7Tx0E9id02aVQm5okWMHXTs20Llirkx80VeMzbV4g+dDFdFI/PNIUgI6NYbGwOBgCtDyXBjBftaTR1q8TNWmG2J5ctVkidQBakI4F9S5hQ3YxAKrBaUUnvqFHtZ8pqnT1ny0K8dmwGvdz4EgiUMnS41BLzv1qLR48l3vAIjY22yBlq2ncaAVlHrR82GSxHKPt0xcVAdYXL3AVGhafVrNsdn8oEjFSun9WvwcLgJdxJvaeeNxYdrzgAAeHaqxCJHle2u03lyIK1OIy7eLMNW4V0gghHyYJnJe1gcZ8DCBKBQ0ATqnryTGFjtyGFnzYkTqt+5jtHe8SUxyxAaPPRQ4i+iFvyUNjPnZcMs9m6oesX5x+ThsGV+lmsnHEMaNokxqe6AOOYpssmcC7nrQsklGBrLlKqljglAEdAEu7xHjzxB+EsBbgNM2oXZsxw13e/uV



I simulated a gray scale volume of 32x32x32 voxels with a solid sphere of radius 8.

make_surface_mesh produces a mesh only over a portion of the sphere.



If I simulate a sphere with a smaller radius, then make_surface_mesh produces a mesh around the entire sphere.



If I simulate a sphere of radius 12, then make_surface_mesh takes a very long time, I did not wait for it to complete.

Here is the code I used.  One INR volume of the sphere having radius 8 is attached.


Thank you.

#include <iostream>

main()
{

string path("-----somewhere------------");
name = "sphere4";
string file = path + name;
file += ".INR";

Tr tr;            // 3D-Delaunay triangulation
C2t3 c2t3(tr);   // 2D-complex in 3D-Delaunay triangulation

// the 'function' is a 3D gray level image
std::cout << "Reading INR: " << file << std::endl;
float thresh = 2.9f;
Gray_level_image image( file.c_str(), thresh );
std::cout << "Completed reading INR with threshold" << thresh << std::endl;

// Carefully chosen bounding sphere: the center must be inside the
// surface defined by 'image' and the radius must be high enough so that
// the sphere actually bounds the whole image.
float xspan = float(image.xdim() * image.vx());
float yspan = float(image.ydim() * image.vy());
float zspan = float(image.zdim() * image.vz());
GT::Point_3 bounding_sphere_center(xspan / 2, yspan / 2, zspan / 2);

float span = sqrt(xspan * xspan + yspan * yspan + zspan * zspan);

GT::FT bounding_sphere_squared_radius = span;
GT::Sphere_3 bounding_sphere(bounding_sphere_center, bounding_sphere_squared_radius);

// definition of the surface, with relative precision
std::cout << "Define surface" << std::endl;
Surface_3 surface(image, bounding_sphere, 1e-2);

// defining meshing criteria
std::cout << "Defining mesh criteria" << std::endl;
// defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30.0f, 0.5f, 1.414f);

// meshing surface, with the "manifold without boundary" algorithm
std::cout << "Making mesh" << std::endl;
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());

file = path + name;
file += ".off";
std::cout << "Writing to " << file << endl;

std::ofstream out(file);
CGAL::output_surface_facets_to_off(out, c2t3);
std::cout << "Final number of points: " << tr.number_of_vertices() << "\n";

}



Attachment: sphere8.INR
Description: sphere8.INR




Archive powered by MHonArc 2.6.19+.

Top of Page