00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <qvdefines.h>
00026 #include <QHash>
00027 std::ostream& operator << ( std::ostream &os, const QPointF &point )
00028 {
00029 os << "QPointF (" << point.x() << ", " << point.y() << ")";
00030 return os;
00031 }
00032
00033 std::ostream& operator << ( std::ostream &os, const QPoint &point )
00034 {
00035 os << "QPoint (" << point.x() << ", " << point.y() << ")";
00036 return os;
00037 }
00038
00039 std::ostream& operator << ( std::ostream &os, const QPointFMatching &matching )
00040 {
00041 os << "QPointFMatching [" << matching.first << "\t<->\t" << matching.second << "]";
00042 return os;
00043 }
00044
00045 uint qHash(const double &value)
00046 {
00047 const uint *i = (uint *) &value;
00048 const uchar *c = (uchar *) &value;
00049
00050 return i[0] + i[1] + c[0] + c[1] + c[2] + c[3] + c[4] + c[5] + c[6] + c[7];
00051 }
00052
00053 uint qHash(const QPointF &point)
00054 {
00055 return qHash(point.x() + point.y());
00056 }
00057
00058 uint qHash(const QPoint &point)
00059 {
00060 return qHash(point.x() + point.y());
00061 }
00062
00063 #include <sys/time.h>
00064 long long getMicroseconds()
00065 {
00066 timeval tv;
00067 gettimeofday(&tv,NULL);
00068 long long ts = tv.tv_sec;
00069 ts *= 1000000;
00070 ts += tv.tv_usec;
00071 return ts;
00072 }
00073
00074 #ifdef GLUPERSPECTIVE_SUBSTITUTE
00075 #include <qvmath.h>
00076 void qvGluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
00077 {
00078 GLdouble xmin, xmax, ymin, ymax;
00079
00080 ymax = zNear * tan(fovy * M_PI / 360.0);
00081 ymin = -ymax;
00082 xmin = ymin * aspect;
00083 xmax = ymax * aspect;
00084
00085
00086 glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
00087 }
00088 #endif // GLUPERSPECTIVE_SUBSTITUTE
00089