misc.cpp
changeset 792 7d67be709091
parent 789 d85834ad8c54
child 802 f076fdec767d
     1.1 --- a/misc.cpp	Mon Sep 07 15:36:57 2009 +0000
     1.2 +++ b/misc.cpp	Tue Sep 08 12:15:39 2009 +0000
     1.3 @@ -1,20 +1,21 @@
     1.4  #include <math.h>
     1.5  
     1.6  #include <qregexp.h>
     1.7 -#include <qpoint.h>
     1.8 +//#include <qpoint.h>
     1.9  #include <stdlib.h>
    1.10  
    1.11  #include "misc.h"
    1.12  
    1.13 +#include "geometry.h"
    1.14 +
    1.15  QString qpointToString (const QPoint &p)
    1.16 -{
    1.17 -	return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
    1.18 -}
    1.19 +{ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; }
    1.20  
    1.21 -QString qpointfToString (const QPointF &p)
    1.22 -{
    1.23 -	return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
    1.24 -}
    1.25 +QString qpointFToString (const QPointF &p)
    1.26 +{ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; }
    1.27 +
    1.28 +QString VectorToString (const Vector &p)
    1.29 +{ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; }
    1.30  
    1.31  ostream &operator<< (ostream &stream, QPoint const &p)
    1.32  { 
    1.33 @@ -28,6 +29,12 @@
    1.34  	return stream;
    1.35  }
    1.36  
    1.37 +ostream &operator<< (ostream &stream, Vector const &p)
    1.38 +{ 
    1.39 +	stream << "("<<p.x()<<","<<p.y()<<")";
    1.40 +	return stream;
    1.41 +}
    1.42 +
    1.43  qreal getAngle(const QPointF &p)
    1.44  {	
    1.45  	// Calculate angle of vector to y-axis