diff -r e95081c21da2 -r 8059b6aa74d7 misc.cpp --- a/misc.cpp Tue Sep 05 09:47:14 2006 +0000 +++ b/misc.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -11,13 +11,25 @@ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; } +QString qpointfToString (const QPointF &p) +{ +// FIXME check this QT4 + return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; +} + ostream &operator<< (ostream &stream, QPoint const &p) { stream << "("<0) - return (float)(M_PI - atan ( (double)(p.x()) / (double)(p.y()) ) ); + return (qreal)(M_PI - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) ); else if (p.x()<0) - return (float)( 2*M_PI - atan ( (double)(p.x()) / (double)(p.y()) ) ); + return (qreal)( 2*M_PI - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) ); else - return (float)( - atan ( (double)(p.x()) / (double)(p.y()) ) ); + return (qreal)( - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) ); } } -QPoint normalise(const QPoint &p) +QPointF normalise(const QPointF &p) { // Calculate normalised position (fixed length) - double px=p.x(); - double py=p.y(); - double x; - double y; - double r=150; + qreal px=p.x(); + qreal py=p.y(); + qreal x; + qreal y; + qreal r=150; if (px==0) { @@ -57,8 +69,8 @@ y=-r; } else { - double sign; - double a; + qreal sign; + qreal a; if (px>0) sign=1; else @@ -87,7 +99,8 @@ return r; } -int max(int a, int b) + +qreal max(qreal a, qreal b) { if (a>b) return a;