void perturb(Slice& slice, Number_type epsilon) { list<string> components; slice.components(back_inserter(components)); for (list<string>::const_iterator it = components.begin(); it != components.end(); ++it) { for (Slice::Contour_iterator cit = slice.begin(*it); cit != slice.end(*it); ++cit) { perturb((*cit)->polygon(), epsilon); } } }
void print_ser(std::ostream& out, const Slice& slice, Number_type thickness) { list<string> components; slice.components(back_inserter(components)); out << "<?xml version=\"1.0\"?>" << endl; out << "<!DOCTYPE Section SYSTEM \"section.dtd\">" << endl; out << endl; out << "<Section index=\"87\" thickness=\"" << thickness << "\" alignLocked=\"true\">" << endl; for (list<string>::const_iterator it = components.begin(); it != components.end(); ++it) { string component(*it); out << "<Transform dim=\"0\"" << endl; out << "xcoef=\" 0 1 0 0 0 0\"" << endl; out << "ycoef=\" 0 0 1 0 0 0\">" << endl; typedef Slice::Contour_const_iterator C_iter; for (C_iter c_it = slice.begin(component); c_it != slice.end(component); ++c_it) { Contour_handle contour = *c_it; const Polygon_2& polygon = contour->polygon(); out << "<Contour name=\"" << component << "\" hidden=\"true\" closed=\"true\" simplified=\"true\" border=\"0 1 0\" fill=\"0 1 0\" mode=\"9\"" << endl; out << "points=\""; // insert points here Polygon_2::Vertex_const_iterator vit; for (vit = polygon.vertices_begin(); vit != polygon.vertices_end(); ++vit) { out << "\t" << vit->x() << " " << vit->y() << "," << std::endl; } out << "\t\"/>" << endl; } out << "</Transform>" << endl; out << endl; } out << "</Section>" << endl; out << endl; out << endl; }
std::string pp(const Slice& slice) { std::stringstream out; out << std::setprecision(pp_precision); list<string> components; slice.components(back_inserter(components)); for (list<string>::const_iterator it = components.begin(); it != components.end(); ++it) { out << *it << ": "; for (Slice::Contour_const_iterator cit = slice.begin(*it); cit != slice.end(*it); ++cit) { out << pp((*cit)->polygon()); } } return out.str(); }