use i/oformat()

This commit is contained in:
Maxime Gimeno 2020-06-12 13:29:30 +02:00
parent ce86d3de12
commit 4b14f5199f
8 changed files with 46 additions and 46 deletions

View File

@ -53,11 +53,11 @@ public:
void write_footer() const { out() << "\n# End of Wavefront obj format #" << std::endl; }
void write_vertex(const double x, const double y, const double z) {
out() << "v " << x << ' ' << y << ' ' << z << '\n';
out() << "v " << oformat(x) << ' ' << oformat(y) << ' ' << oformat(z) << '\n';
}
void write_vertex_normal(const double x, const double y, const double z) {
out() << "vn " << x << ' ' << y << ' ' << z << '\n';
out() << "vn " << oformat(x) << ' ' << oformat(y) << ' ' << oformat(z) << '\n';
}
void write_vertex_color(const double, const double, const double) { }

View File

@ -75,7 +75,7 @@ public:
}
else
{
out() << '\n' << x << ' ' << y << ' ' << z;
out() << '\n' << oformat(x) << ' ' << oformat(y) << ' ' << oformat(z);
}
}
@ -89,7 +89,7 @@ public:
}
else
{
out() << ' ' << ' ' << x << ' ' << y << ' ' << z;
out() << ' ' << ' ' << oformat(x) << ' ' << oformat(y) << ' ' << oformat(z);
}
}
@ -103,7 +103,7 @@ public:
}
else
{
out() << ' ' << ' ' << r << ' ' << g << ' ' << b;
out() << ' ' << ' ' << oformat(r) << ' ' << oformat(g) << ' ' << oformat(b);
}
}
@ -116,7 +116,7 @@ public:
}
else
{
out() << ' ' << ' ' << tx << ' ' << ty;
out() << ' ' << ' ' << oformat(tx) << ' ' << oformat(ty);
}
}

View File

@ -57,7 +57,7 @@ public:
void write_vertex( const double x, const double y, const double z)
{
out() << " " << x << ' ' << y << ' ' << z << ',' <<'\n';
out() << " " << oformat(x) << ' ' << oformat(y) << ' ' << oformat(z) << ',' <<'\n';
}
void write_facet_header() const

View File

@ -106,21 +106,21 @@ operator<<(Inventor_ostream& os,
os.os() << "\n Coordinate3 { \n"
<< Indent << "point [\n"
<< Indent << " "
<< CGAL::to_double(t[0].x()) << " "
<< CGAL::to_double(t[0].y()) << " "
<< CGAL::to_double(t[0].z()) << " ,\n"
<< oformat(CGAL::to_double(t[0].x())) << " "
<< oformat(CGAL::to_double(t[0].y())) << " "
<< oformat(CGAL::to_double(t[0].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[1].x()) << " "
<< CGAL::to_double(t[1].y()) << " "
<< CGAL::to_double(t[1].z()) << " ,\n"
<< oformat(CGAL::to_double(t[1].x())) << " "
<< oformat(CGAL::to_double(t[1].y())) << " "
<< oformat(CGAL::to_double(t[1].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[2].x()) << " "
<< CGAL::to_double(t[2].y()) << " "
<< CGAL::to_double(t[2].z()) << " ,\n"
<< oformat(CGAL::to_double(t[2].x())) << " "
<< oformat(CGAL::to_double(t[2].y())) << " "
<< oformat(CGAL::to_double(t[2].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[3].x()) << " "
<< CGAL::to_double(t[3].y()) << " "
<< CGAL::to_double(t[3].z()) << " ]"
<< oformat(CGAL::to_double(t[3].x())) << " "
<< oformat(CGAL::to_double(t[3].y())) << " "
<< oformat(CGAL::to_double(t[3].z())) << " ]"
<< "\n } #Coordinate3" ;
os.os() << "\n IndexedFaceSet {"
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"

View File

@ -70,7 +70,7 @@ public:
void write_vertex( const double x, const double y, const double z)
{
out() << " "
<< x << ' ' << y << ' ' << z << ',' << '\n';
<< oformat(x) << ' ' << oformat(y) << ' ' << oformat(z) << ',' << '\n';
}
void write_facet_header() const

View File

@ -71,21 +71,21 @@ operator<<(VRML_1_ostream& os,
os.os() << "\n Coordinate3 { \n"
<< Indent << "point [\n"
<< Indent << " "
<< CGAL::to_double(t[0].x()) << " "
<< CGAL::to_double(t[0].y()) << " "
<< CGAL::to_double(t[0].z()) << " ,\n"
<< oformat(CGAL::to_double(t[0].x())) << " "
<< oformat(CGAL::to_double(t[0].y())) << " "
<< oformat(CGAL::to_double(t[0].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[1].x()) << " "
<< CGAL::to_double(t[1].y()) << " "
<< CGAL::to_double(t[1].z()) << " ,\n"
<< oformat(CGAL::to_double(t[1].x())) << " "
<< oformat(CGAL::to_double(t[1].y())) << " "
<< oformat(CGAL::to_double(t[1].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[2].x()) << " "
<< CGAL::to_double(t[2].y()) << " "
<< CGAL::to_double(t[2].z()) << " ,\n"
<< oformat(CGAL::to_double(t[2].x())) << " "
<< oformat(CGAL::to_double(t[2].y()) << " "
<< oformat(CGAL::to_double(t[2].z()) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[3].x()) << " "
<< CGAL::to_double(t[3].y()) << " "
<< CGAL::to_double(t[3].z()) << " ]"
<< oformat(CGAL::to_double(t[3].x())) << " "
<< oformat(CGAL::to_double(t[3].y())) << " "
<< oformat(CGAL::to_double(t[3].z())) << " ]"
<< "\n } #Coordinate3" ;
os.os() << "\n IndexedFaceSet {"

View File

@ -97,7 +97,7 @@ inline VRML_2_ostream& operator<<(VRML_2_ostream& os,
inline VRML_2_ostream& operator<<(VRML_2_ostream& os,
const double& d)
{
os.os() << d;
os.os() << oformat(d);
return os;
}
@ -129,21 +129,21 @@ operator<<(VRML_2_ostream& os,
" coord Coordinate {\n"
" point [ \n"
<< Indent << " "
<< CGAL::to_double(t[0].x()) << " "
<< CGAL::to_double(t[0].y()) << " "
<< CGAL::to_double(t[0].z()) << " ,\n"
<< oformat(CGAL::to_double(t[0].x())) << " "
<< oformat(CGAL::to_double(t[0].y())) << " "
<< oformat(CGAL::to_double(t[0].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[1].x()) << " "
<< CGAL::to_double(t[1].y()) << " "
<< CGAL::to_double(t[1].z()) << " ,\n"
<< oformat(CGAL::to_double(t[1].x())) << " "
<< oformat(CGAL::to_double(t[1].y())) << " "
<< oformat(CGAL::to_double(t[1].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[2].x()) << " "
<< CGAL::to_double(t[2].y()) << " "
<< CGAL::to_double(t[2].z()) << " ,\n"
<< oformat(CGAL::to_double(t[2].x())) << " "
<< oformat(CGAL::to_double(t[2].y())) << " "
<< oformat(CGAL::to_double(t[2].z())) << " ,\n"
<< Indent << " "
<< CGAL::to_double(t[3].x()) << " "
<< CGAL::to_double(t[3].y()) << " "
<< CGAL::to_double(t[3].z()) <<
<< oformat(CGAL::to_double(t[3].x())) << " "
<< oformat(CGAL::to_double(t[3].y())) << " "
<< oformat(CGAL::to_double(t[3].z())) <<
"\n ]\n"
" }\n"
" solid FALSE\n"

View File

@ -209,7 +209,7 @@ void write_soup_points_tag(std::ostream& os,
{
os << "\">\n";
for(const Point& p : points)
os << p.x() << " " << p.y() << " " << p.z() << " ";
os << oformat(p.x()) << " " << oformat(p.y()) << " " << oformat(p.z()) << " ";
os << " </DataArray>\n";
}
os << " </Points>\n";