Simple wrapper to dump vcg objects to qstring

This commit is contained in:
Paolo Cignoni 2010-04-28 01:49:27 +00:00
parent 493553c5f1
commit 49ccc24606
1 changed files with 34 additions and 0 deletions

34
wrap/qt/to_string.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef TOSTRING_H
#define TOSTRING_H
#include <QString>
#include <cstdlib>
inline QString toString( const Point4f& p ){
QString s;
s.sprintf("%f %f %f %f", p[0], p[1], p[2], p[3]);
return s;
}
inline QString toString( const Point3f& p ){
QString s;
s.sprintf("%f %f %f", p[0], p[1], p[2]);
return s;
}
inline QString toString( const Point2f& p ){
QString s;
s.sprintf("%f %f", p[0], p[1]);
return s;
}
inline QString toString( const Point2i& p ){
QString s;
s.sprintf("%d %d", p[0], p[1]);
return s;
}
inline QString toString(Matrix44f& m){
QString mat;
for(int i=0; i<3; i++){
mat.append( toString( m.GetRow4(i) ) );
mat.append("\n");
}
return mat;
}
#endif // TOSTRING_H