#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Labeled_mesh_domain_3.h>
#include <CGAL/Mesh_domain_with_polyline_features_3.h>
#include <CGAL/make_mesh_3.h>
typedef K::FT FT;
typedef K::Point_3 Point;
typedef FT (Function)(const Point&);
typedef std::vector<Point> Polyline_3;
typedef std::list<Polyline_3> Polylines;
#ifdef CGAL_CONCURRENT_MESH_3
#else
#endif
Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_index> C3t3;
FT sphere_function1 (const Point& p)
FT sphere_function2 (const Point& p)
FT sphere_function (const Point& p)
{
if(sphere_function1(p) < 0 || sphere_function2(p) < 0)
return -1;
else
return 1;
}
#include <cmath>
int main()
{
Mesh_domain domain =
Mesh_domain::create_implicit_mesh_domain(sphere_function,
K::Sphere_3(Point(1, 0, 0), 6.));
Mesh_criteria criteria(params::edge_size(0.15).
facet_angle(25).
facet_size(0.15).
cell_radius_edge_ratio(2).
cell_size(0.15));
Polylines polylines (1);
Polyline_3& polyline = polylines.front();
for(int i = 0; i < 360; ++i)
{
Point p (1, std::cos(i*CGAL_PI/180), std::sin(i*CGAL_PI/180));
polyline.push_back(p);
}
polyline.push_back(polyline.front());
domain.add_features(polylines.begin(), polylines.end());
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
params::no_features());
std::ofstream medit_file("out-no-protection.mesh");
medit_file.close();
c3t3.clear();
c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
medit_file.open("out-with-protection.mesh");
medit_file.close();
return 0;
}
The class Labeled_mesh_domain_3 implements indexed domains.
Definition: Labeled_mesh_domain_3.h:359
The class gathers the refinement criteria for mesh tetrahedra and surface facets where surface facets...
Definition: Mesh_criteria_3.h:186
The class Mesh_domain_with_polyline_features_3 enables the user to add some 0- and 1-dimensional feat...
Definition: Mesh_domain_with_polyline_features_3.h:535
void write_MEDIT(std::ostream &os, const T3 &t3, const NamedParameters &np=parameters::default_values())
const CGAL::Origin ORIGIN
Kernel::FT squared_distance(Type1< Kernel > obj1, Type2< Kernel > obj2)