Пример #1
0
SCHNAPPS_PLUGIN_MESHGEN_API void tetrahedralize(const CGALParameters& param, MapHandler<CMap2>* input_surface_map, const CMap2::VertexAttribute<VEC3>& position_attribute, MapHandler<CMap3>* output_volume_map)
{

	using Kernel		= CGAL::Exact_predicates_inexact_constructions_kernel;
	using Polyhedron	= CGAL::Polyhedron_3<Kernel>;
	using Domain		= CGAL::Polyhedral_mesh_domain_3<Polyhedron, Kernel>;
	using Triangulation	= CGAL::Mesh_triangulation_3<Domain>::type;
	using Criteria		= CGAL::Mesh_criteria_3<Triangulation>;
	using C3T3			= CGAL::Mesh_complex_3_in_triangulation_3<Triangulation>;
	using namespace CGAL::parameters;

	if (!input_surface_map || !output_volume_map || !position_attribute.is_valid())
		return;

	auto poly = build_polyhedron(input_surface_map, position_attribute);
	if (poly)
	{

		Criteria criteria(
					cell_size = param.cell_size_,
					facet_angle = param.facet_angle_,
					facet_size =  param.facet_size_,
					facet_distance= param.facet_distance_,
					cell_radius_edge_ratio = param.cell_radius_edge_ratio_);

		Domain mesh_domain(*poly);

		tetrahedralize(param, mesh_domain, criteria, output_volume_map);
	}
}
SCHNAPPS_PLUGIN_MESHGEN_API std::unique_ptr<CGAL::Polyhedron_3<CGAL::Exact_predicates_inexact_constructions_kernel>> build_polyhedron(CMap2Handler* mh, const CMap2::VertexAttribute<VEC3>& position_attribute)
{
	if (!mh || !position_attribute.is_valid())
		return nullptr;
	auto poly = cgogn::make_unique<CGAL::Polyhedron_3< CGAL::Exact_predicates_inexact_constructions_kernel>>();
	PolyhedronBuilder builder(mh, position_attribute);
	poly->delegate(builder);
	return poly;
}