Subject: CGAL users discussion list
List archive
- From: kenichiro yoshimi <>
- To:
- Subject: [cgal-discuss] How to tetrahedralize with feature edges
- Date: Wed, 4 Jun 2014 11:34:46 +0900
Hi,
I am new to CGAL (using CGAL4.4) and trying to tetrahedralize a polyhedron with features. I apply to the attached surface mesh (data/mesh.off) using the following code, but the sharp feature edges are not preserved.
---------------------------------
#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/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>
// IO
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h>
// VTK
#include <vtkSmartPointer.h>
#include <vtkUnstructuredGrid.h>
#include <vtkXMLUnstructuredGridWriter.h>
// STL
#include <string>
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<
Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
// To avoid verbose function and named parameters call
using namespace CGAL::parameters;
int main()
{
// Create domain
Mesh_domain domain("data/mesh.off");
// Get sharp features
domain.detect_features();
// Mesh criteria
Mesh_criteria criteria(facet_angle=25, facet_size=0.3, facet_distance=0.1,
cell_radius_edge_ratio=3);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
lloyd(time_limit=30),
no_exude(),
perturb(sliver_bound=10, time_limit=15));
// Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets
Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.4);
// Mesh refinement
CGAL::refine_mesh_3(c3t3, domain, new_criteria);
std::cout << "Mesh refinement\n";
CGAL::perturb_mesh_3(c3t3, domain, time_limit=15);
std::cout << "Mesh optimization\n";
// Output
//std::ofstream medit_file("out.mesh");
//c3t3.output_to_medit(medit_file);
vtkSmartPointer<vtkUnstructuredGrid> output =
vtkSmartPointer<vtkUnstructuredGrid>::New();
CGAL::output_c3t3_to_vtk_unstructured_grid(c3t3, output);
vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
writer->SetFileName("out.vtu");
writer->SetInputData(output);
writer->Update();
}
---------------------------------
How can I make mesh nodes forced on feature edges? Any kind of help would be appreciated.
Thanks,
yoshimi
Attachment:
data.tar.gz
Description: GNU Zip compressed data
Attachment:
tetra_with_featrues.png
Description: PNG image
- [cgal-discuss] How to tetrahedralize with feature edges, kenichiro yoshimi, 06/04/2014
- Re: [cgal-discuss] How to tetrahedralize with feature edges, Laurent Rineau (CGAL/GeometryFactory), 06/04/2014
Archive powered by MHonArc 2.6.18.