Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Help with make_surface_mesh


Chronological Thread 
  • From: Sebastien Loriot <>
  • To:
  • Subject: Re: [cgal-discuss] Help with make_surface_mesh
  • Date: Mon, 4 Jan 2021 18:19:15 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:ZtDdbB1L/KtegJ4ysmDT+DRfVm0co7zxezQtwd8ZsesWLv3xwZ3uMQTl6Ol3ixeRBMOHsq0C0bGN+PC5EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe/bL9oMhm7owvcusYVjId/N6081gbHrnxUdupM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02QaRXAzo6PW814tbrtQTYQguU+nQcSGQWnQFWDAXD8Rr3Q43+sir+tup6xSmaIcj7Rq06VDi+86tmTgLjhSEaPDA77W7XkNR9gr9FrhKvpxJxwIDab4+aO/V8YqzTcsgXRXZCU8tLSyBNHo2xYosJAuEcPehYtY79p14WoBWjGwajH/ngyiRUhn/3w6I61fkqHwfB3Aw6HtIOt2jUp8jyOacJVeC1y7PIzTTEb/NKwzv97YzIfwsuofGJR71wcM7RxVMzGAPCi1WdsIroNC6a2eoRqWaU9fZgVf6xhG49rQF8uiSjytoyh4TGmI4bxUzJ+Dl2zYs6J9C1Rkx2bMK6HZVfqSyXNIl7Tt8+T2xnpCs3yL4LtJylcSUOxpkr2hDSZv+BfoOV7BzjU+ORLi15hHJjYL+/hhCy8VKhyuLmTMW03kxKoyxYmdfPrnAAzwLf5tSDR/dn/Uqs2SyD2x7N5u1ZO0w5mrfXJ4Y/zrEqipYfrEHOETHqlErsiaKaaFko9vWt5unpeLrquIOQOopwhw3jLKgjnsmyDOU3PwcSUWiW/Pmz2b3/8UD9RbhFlfM7kqfDv53cOM8VvLS2AxVP3YYm8xu/Dymp0NAfnXQfKVJKYhOHj4zwN1DAOvD0EO6zg1qjnTt23fzGMbrhApLCLnjHjrjtZ6py60lZyAYrzNBf4YxbCq0ZLf7tRkP8sMbUAxw5PgCu3errFshx2pkRVG6SGqOZNbndsV6M5uIhOemMY4oVtS7mK/gh4P7ul345mVgBfaWz2JsXbGu1HvtjI0qDYHrshs0NHnsNvgo7VODqkkGNUSZPZ3auWKIx/i00CI28AofHX4yinb2B3DynEZ1LfWBGEUuBEWzodoWBQ/cDcjieIs5nkjweVLiuUZUt1R+0tFyy9rx8M+CB+jEErYmxk59u9ujLnFcz8yZ1BoKTySaWXmRslyQJQTExm6twqEg4xlaY2rVjmK9lE8dO7c9EQhtvNYLA1/coTJfpSwfZd5GITkynS5OoG3YqX9cpypgPZUh6XN6thxSG0yuxCKIOjO+3A8k//avYmnTwPM1g0G3u1a87jlBgTNEcG3ehg/tE+gLaHJLInkPRs6GwdKMAlHrW8GCZzG2S+kRceAF1WKTBG3sYYx2F/pzC+kreQur2WvwcOQxbxJvac/cYWpjSlVxDAczbFpHGeWvowjW/AB+JwvWHa4+4IzxAjhWYM1ANlkUoxVjDNQU6AX388WfXDTgrCki2Jk2wqK9xr3S0SkJyxAaPPRU4huiFvyUNjPnZcMs9m7cNuSMvsTJxRQ/v0NffCt7GrA1kLvxR

Did you update the radius of the bounding sphere each time?


Sebastien.


On 1/4/21 5:42 PM, Tony Apicella wrote:


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";

}




--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss




Archive powered by MHonArc 2.6.19+.

Top of Page