Subject: CGAL users discussion list
List archive
[cgal-discuss] Unexpected behaviour mesh generation from implicit surfaces sphere inside sphere
Chronological Thread
- From: max <>
- To:
- Subject: [cgal-discuss] Unexpected behaviour mesh generation from implicit surfaces sphere inside sphere
- Date: Thu, 4 Jun 2020 11:14:18 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:ITwDeRbgz1IwgMs4fbH6p+//LSx+4OfEezUN459isYplN5qZr869bnLW6fgltlLVR4KTs6sC17OL9fm8ACdZuN6oizMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9vLBi6txjdu8YLjYdtN6o91wbCr2dVdehR2W5mP0+YkQzm5se38p5j8iBQtOwk+sVdT6j0fLk2QKJBAjg+PG87+MPktR/YTQuS/XQcSXkZkgBJAwfe8h73WIr6vzbguep83CmaOtD2TawxVD+/4apnVAPkhSEaPDM/7WrZiNF/jLhDrRyhuhJx3Y3abo+bO/VxYqzTcsgXRXZYXstLSyBNHo2xYokJAuEcPehYtY79p14WoBu7HwatC/7kxzhNhnDs0qw60uEhEQDC3AwhBd0Otm7YrNbyNKcSVeC617PIwivFb/NQxzj98pPFch8kofCDR75/bNTexFApGgjYgVqetZbrMCmJ1uQRrWeb9exgWPqyh2Mpqgx9vDmiyMkih4fGm48Z11LJ+CF3zos6O9G1RlB2bN6qHpZSqi2XM4l7T8M8T210uis3yrMLt5G/cSYEzpks2h3Ra+SffoSW/x7vSvydLSlmiH9nYr6zmhS//VK+xuHiTsW50lRHojBYntXRrHwBygLf5tadRvZ/8Uqs3yuE2RrJ5eFeO080kLLWK54/zb40kZoeqUHDHijrmEXqlqOWeUAk++ey5+ThfLrmuoeQN45yig7gLqQjgtKzDfkmPgQUQWSX5+ax2Kf+8UD7WrlGkOM6nrHcsJ/AJMQboqC5AxVS0oYm8xu/Ci2p0dsZnXkCLVJFfBOHgJLvO13UI/D4Cve/g1C3nzdx2f/GOLvhDYvXLnXYn7fheLl851RBxwUt1dxf/Y5bCqkdIPLvXU/8rMDXDhAjPAyw2uroFdR91pgCVmKSGa+ZK7jfsUSI5+IqO+mDfpUZuDf7K/g/5v7hl2U1mVEHffrh4ZxCY3+xGrFqIl6SfGH3qtYHC2YD+AQkH8Lwj1jXVDdDLyK3VrI94zA/CYugS4TERoSnmrGH2iqhNpJTdiZKBwbfQj/Ta4yYVqJUO2qpKch7n2lcDOXze8oazRir8TTC5f9nI+7To3FKsJX+yJ564v2Vkxwup2QtXpatllqVRmQxpVsmAjo/3aRxu0t4mgWM1Lg+j/EKTIUPtcMMaR8zMNvn98I/E8r7ClDOe8fPRFv0Gtg=
Dear CGAL Community,
since this is my post: hello to all of you! :)
I am currently trying to generate a tetrahedral mesh of a sphere inside
another sphere (tet mesh of a sphere of rad 1 such that some vertices on
the inside have distance 0.5 to the origin). My approach is to use a
vector of implicit functions for both spheres, while playing around with
it I experienced the following unexpected behaviour (minimal working
example, slightly different):
I have one big sphere and try to generate a mesh of the big sphere
without a smaller sphere on the inside (a sphere-hole so to say).
Depending on how I choose the centers (m1, m2) and radii (r1, r2) of the
two spheres, I get quite different results:
- case 1: Sphere boundaries intersect (e.g. m1 = (0,0,0), r1 = 1.0,
m2=(0., 0., 0.9), r2= 0.5): exactly as expected, the smaller sphere is
'cut out' from the bigger one
- case 2: Spheres boundaries not intersecting, smaller sphere
centered around the origin (e.g. m1 = (0,0,0), r1 = 1.0, m2=(0., 0.,
0.), r2=0.5): some points but no tets are generated
- case 3: Sphere boundaries not intersecting, smaller sphere does
not contain the origin: (e.g. m1 = (0,0,0), r1 = 1.0, m2=(0., 0., 0.5),
r2=0.1): big sphere is correctly tetrahedralized, smaller sphere is
ignored (not left out, as if we were only meshing the big sphere)
I suspect this behaviour to have sth to do with the internal mesh
generation process that I do not completely understand. I added a mini
example of the code below.
So My questions are:
Can somebody explain this behaviour to me?
Is it a necessary condition for the two implicit surfaces to intersect
in order for the situation to make sense in this setting?
How come that case 2 does not seem to produce any tets at all?
Sth similar happens when I am adding the 'inner' sphere again
(uncommenting "// vps.push_back("--");" or not specyfing the vps vector
at all. (in these cases only the inner sphere gets meshed). Am I maybe
using the wrong approach alltogether for my two sphere problem described
earlier?
Thank you very much for the read, I would be more than happy about any
kind of advice.
Have a nice day!
Cheers,
Max
##### BEGIN CODE: #####
using namespace CGAL::parameters;
// Domain
typedef FT_to_point_function_wrapper<typename TKernel::FT, typename
TKernel::Point_3> Function;
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
Function_wrapper;
typedef typename Function_wrapper::Function_vector Function_vector;
typedef CGAL::Labeled_mesh_domain_3<TKernel> Mesh_domain;
// Triangulation
typedef typename CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
// Mesh Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
typedef typename Mesh_criteria::Facet_criteria Facet_criteria;
typedef typename Mesh_criteria::Cell_criteria Cell_criteria;
typedef typename TKernel::Point_3 Point;
double implicit_sphere_function(double x, double y, double z, double r,
double mx, double my, double mz) {
return (x-mx)*(x-mx) + (y-my)*(y-my) + (z-mz)*(z-mz) - r*r;
}
// circle centers and radii are varied here (this example would be
m1=(0.,0.,0.), r1=1., m2=(0., 0., 0.) r2 = 0.1)
Function f1( [](double x, double y, double z) -> double{return
implicit_sphere_function(x, y, z, 1.0, 0., 0., 0. );} );
Function f2( [](double x, double y, double z) -> double{return
implicit_sphere_function(x, y, z, 0.1, 0., 0., 0. );} );
Function_vector v;
v.push_back(f1);
v.push_back(f2);
std::vector<std::string> vps;
// vps.push_back("--");
vps.push_back("-+");
// DOMAIN
Mesh_domain domain(function = Function_wrapper(v, vps),
bounding_object = CGAL::Bbox_3(-3, -3, -3, 3, 3, 3),
relative_error_bound = 1e-6);
// CRITERIA
Facet_criteria facet_criteria(30, mOptions.facet_size, 0.02); // angle,
size, approximation
Cell_criteria cell_criteria(mOptions.cell_radius_edge_ratio,
mOptions.cell_size); // radius-edge ratio, size
//Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size,
approximation
//Cell_criteria cell_criteria(2., 0.4); // radius-edge ratio, size
Mesh_criteria criteria(facet_criteria, cell_criteria);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_exude(),
no_perturb());
##### END CODE #####
- [cgal-discuss] Unexpected behaviour mesh generation from implicit surfaces sphere inside sphere, max, 06/04/2020
Archive powered by MHonArc 2.6.19+.