00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00037 #include <iostream>
00038 #include <qvmath.h>
00039
00040 int main(int argc, char *argv[])
00041 {
00042
00043 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(2.0, 1.0, -8.0), QPointF(3.5, 1.0))) < 1e-10, "qvPointLineDistance()", "test number 1");
00044 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(2.0, 1.0, -8.0), QPointF(3.5, 1.0))) < 1e-10, "qvPointLineDistance()", "test number 2");
00045 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(2.0, 1.0, -8.0), QPointF(2, 4))) < 1e-10, "qvPointLineDistance()", "test number 3");
00046 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(3, -1, 6), QPointF(5, 2)) - 19.0*sqrt(10)/10.0) < 1e-10, "qvPointLineDistance()", "test number 4");
00047 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(3, 4, -9), QPointF(-2, 5)) - 1.0) < 1e-10, "qvPointLineDistance()", "test number 5");
00048 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(2, 1, 4), QPointF(3, -5)) - sqrt(5)) < 1e-10, "qvPointLineDistance()", "test number 6");
00049 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(4, 3, -10), QPointF(3, -4)) - 2.0) < 1e-10, "qvPointLineDistance()", "test number 7");
00050 Q_ASSERT_X( ABS(pointLineDistance(QV3DPointF(2, -1, 4), QPointF(4, 1)) - ABS(8-1+4)/sqrt(4+1)) < 1e-10, "qvPointLineDistance()", "test number 8");
00051
00052 return 0;
00053 }
00054