34 #ifndef AIMS_IO_POVW_H 35 #define AIMS_IO_POVW_H 51 template<
int D,
class T=Vo
id>
62 inline std::string removeExtension(
const std::string& name)
const;
69 template <
int D,
class T>
74 writer.write( thing );
79 template <
int D,
class T>
82 std::string res = name;
84 if( res.length() > 4 )
85 ext = res.substr(
int(res.length() - 4), 4 );
87 res = res.substr( 0, res.length() - 4 );
92 template <
int D,
class T>
95 std::string fname = removeExtension( _name ) +
".pov";
96 std::ofstream os( fname.c_str() );
101 os <<
"mesh2 {" << std::endl;
106 if ( is != thing.end() ) {
107 const std::vector<Point3df> &vert = (*is).second.
vertex();
108 const std::vector<Point3df> &
norm = (*is).second.normal();
109 const std::vector<AimsVector<uint,D> > &poly
110 = (*is).second.polygon();
114 os <<
" vertex_vectors {" << std::endl
115 << vert.size() <<
"," << std::endl <<
" ";
116 for( std::vector<Point3df>::const_iterator iv = vert.begin();
117 iv != vert.end(); ++iv ) {
118 os <<
"<" << (*iv)[0] <<
"," << (*iv)[1] <<
"," << (*iv)[2] <<
">,";
120 os <<
" }" << std::endl;
123 if ( ! norm.empty() ) {
124 os <<
" normal_vectors {" << std::endl
125 << norm.size() <<
"," << std::endl <<
" ";
126 for( std::vector<Point3df>::const_iterator in = norm.begin();
127 in != norm.end(); ++in ) {
128 os <<
"<" << (*in)[0] <<
"," << (*in)[1] <<
"," << (*in)[2] <<
">,";
130 os <<
" }" << std::endl;
134 os <<
" face_indices {" << std::endl
135 << poly.size() <<
"," << std::endl <<
" ";
137 poly.begin(); ip != poly.end(); ++ip ) {
138 os <<
"<" << (*ip)[0] <<
"," << (*ip)[1] <<
"," << (*ip)[2] <<
">,";
140 os <<
" }" << std::endl;
142 os <<
" pigment { Gray80 }\n}" << std::endl;
The class for EcatSino data write operation.
POV (http://www.povray.org) format writer for mesh objects.
PovWriter(const std::string &name)
The template class to manage a mesh with time if needed.
std::string removeExtension(const std::string &name) const
Return a name without .pov extension.
void write(const AimsTimeSurface< D, T > &thing)
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of verteces of the surface of index 0.
AIMSDATA_API float norm(const Tensor &thing)
std::map< int, AimsSurface< D, T > >::const_iterator const_iterator