Subject: CGAL users discussion list
List archive
- From: Zohar <>
- To:
- Subject: [cgal-discuss] Re: Bug: Mesh generation crash
- Date: Mon, 2 Jul 2012 06:34:51 -0700 (PDT)
You are right, I forgot about the squared radius. Also I missed that the
domain must bound the surface, thanks for pointing that out, and explaining
why. Currently it works, but here are a few code snippets for future
reference if I have more problems.
Thanks!
typedef CGAL::Exact_predicates_inexact_constructions_kernel GT;
struct cg_implicit_function {
cg_implicit_function(ImplicitFunction &_f) : f(_f) {}
GT::FT operator()(GT::Point_3 cp) const {
double ret = f.eval(
CGAL::to_double(cp.x()),
CGAL::to_double(cp.y()),
CGAL::to_double(cp.z()));
return ret;
}
ImplicitFunction &f;
};
// Domain
typedef CGAL::Implicit_mesh_domain_3<cg_implicit_function,GT> Mesh_domain;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr3;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr3> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr3> Mesh_criteria;
MObject extract_surface_cg_tet(ImplicitFunction &f, Vector3d pt, double
radius_bound,
double distance_bound,
double bounding_sphere_radius)
{
GT::Point_3 inner_pt(pt(0), pt(1), pt(2));
cout << "Extract surface" << endl;
MObject omesh;
// domain
cg_implicit_function cgf(f);
// Radius should be squared radius!
Mesh_domain domain(cgf, GT::Sphere_3(inner_pt,
bounding_sphere_radius*bounding_sphere_radius));
// Mesh criteria
Mesh_criteria criteria(
facet_angle = 25, //
facet_size = radius_bound, //
facet_distance = distance_bound, // facet_distance
cell_radius_edge_ratio = 3, // cell_radius_edge_ratio
cell_size = radius_bound // cell_size
);
// Mesh_criteria criteria(facet_angle=25, facet_size=0.15,
facet_distance=0.008,
// cell_radius_edge_ratio=3);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
// medit
if ( 0 ) {
ofstream medit_file("/8/out.mesh");
c3t3.output_to_medit(medit_file);
}
// convert reconstructed surface mesh
vector<GT::Point_3> points;
vector<int> tris;
get_boundary_of_c3t3(c3t3, 0, points, tris);
omesh = cgal2mesh(points, tris);
return omesh;
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Bug-Mesh-generation-crash-tp4655336p4655342.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- Re: [cgal-discuss] Re: Bug: Mesh generation crash, Laurent Rineau (CGAL/GeometryFactory), 07/02/2012
- [cgal-discuss] Re: Bug: Mesh generation crash, Zohar, 07/02/2012
Archive powered by MHonArc 2.6.18.