added "ToAscii" and "SetFromAscii" methods to load/store current trackball status from/to ascii strings

(intended uses: clipboard operations and comments inside png snapshots!)
This commit is contained in:
mtarini 2007-01-15 15:04:15 +00:00
parent a07b6e638a
commit 722bd7a696
2 changed files with 24 additions and 0 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.16 2006/07/26 13:54:45 cignoni
Reversed the direction of wheel scaling and added middle mouse panning
Revision 1.15 2006/02/13 13:15:52 cignoni
Added Scale and Translate methods.
Added many drawing hints and raised the default num. of steps when drawing circles.
@ -204,6 +207,21 @@ void Trackball::DrawPlane() {
glEnd();
}
void Trackball::ToAscii(char* result){
float * f = (float*) &track;
sprintf(result, "trackball(%f,%f,%f,%f,%f,%f,%f,%f,%f)",
f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8] );
}
bool Trackball::SetFromAscii(char * st){
float * f = (float*) &track;
int res= sscanf(st, "trackball(%f,%f,%f,%f,%f,%f,%f,%f,%f)",
f+0,f+1,f+2,f+3,f+4,f+5,f+6,f+7,f+8 );
return res=9;
}
void Trackball::DrawPlaneHandle() {
float r=1.0;
float dr=r/10.0f;

View File

@ -25,6 +25,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.11 2006/08/23 15:40:57 marfr960
*** empty log message ***
Revision 1.10 2006/02/13 13:15:52 cignoni
Added Scale and Translate methods.
Added many drawing hints and raised the default num. of steps when drawing circles.
@ -235,6 +238,9 @@ namespace vcg {
TRACK_SCALE = 13
};
// loads/stores current status from/to ascii stings
void ToAscii(char * st);
bool SetFromAscii(char * st);
//protected:
View<float> camera;