#include #include #include #include #include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Surface_mesh SMesh; typedef CGAL::Polyhedron_3 Polyhedron; template struct Bot { Bot(MAP map):map(map){} template void operator()(const T&,VD vd) const { put(map, vd, get(map, vd)+Kernel::Vector_3(-2.0,0.0,1.0)); } MAP map; }; template struct Top { Top(MAP map):map(map){} template void operator()(const T&, VD vd) const { put(map, vd, get(map, vd)+Kernel::Vector_3(0.0,2.0,-1.0)); } MAP map; }; template void test_mesh(const char* filename) { Mesh in, out; std::ifstream input(filename); if (!input || !(input >> in)) { std::cerr << "Error: cannot read Surface Mesh : " << filename << "\n"; assert(!CGAL::is_empty(in)); assert(false); return ; } CGAL::Polygon_mesh_processing::extrude_mesh(in, out, Kernel::Vector_3(0.0, 0.0, -1.0)); std::ofstream extruded_off("extruded.off"); extruded_off << out; extruded_off.close(); out.clear(); typedef typename boost::property_map::type VPMap; Bot bot(get(CGAL::vertex_point, out)); Top top(get(CGAL::vertex_point, out)); CGAL::Polygon_mesh_processing::extrude_mesh(in, out, bot, top); std::ofstream gen_extruded_off("gen_extruded.off"); gen_extruded_off << out; gen_extruded_off.close(); std::cerr << "All done." << std::endl; } int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/quad.off"; test_mesh(filename); test_mesh(filename); return 0; }