예제 #1
0
Polylines PolylineCollection::chained_path(const Polylines &src, bool no_reverse)
{
    return (src.empty() || src.front().points.empty()) ?
        Polylines() :
        _chained_path_from(src, src.front().first_point(), no_reverse
#if SLIC3R_CPPVER >= 11
        , false
#endif
    );
}
int main()
{
  // Domain (Warning: Sphere_3 constructor uses squared radius !)
  Mesh_domain domain(sphere_function,
                     K::Sphere_3(Point(1, 0, 0), 6.));

  // Mesh criteria
  Mesh_criteria criteria(edge_size = 0.15,
                         facet_angle = 25, facet_size = 0.15,
                         cell_radius_edge_ratio = 2, cell_size = 0.15);
  
  // Create edge that we want to preserve
  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()); // close the line

  // Insert edge in domain
  domain.add_features(polylines.begin(), polylines.end());
  
  // Mesh generation without feature preservation
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
                                      CGAL::parameters::no_features());

  std::ofstream medit_file("out-no-protection.mesh");
  c3t3.output_to_medit(medit_file);
  medit_file.close();
  c3t3.clear();

  // Mesh generation with feature preservation
  c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
  
  // Output
  medit_file.open("out-with-protection.mesh");
  c3t3.output_to_medit(medit_file);
  medit_file.close();

  return 0;
}