| 39 | } // namespace |
| 40 | |
| 41 | UNIT_TEST(PointDToPointU_Epsilons) |
| 42 | { |
| 43 | m2::PointD const arrPt[] = {{-180, -180}, {-180, 180}, {180, 180}, {180, -180}}; |
| 44 | m2::PointD const arrD[] = {{1, 1}, {1, -1}, {-1, -1}, {-1, 1}}; |
| 45 | size_t const count = ARRAY_SIZE(arrPt); |
| 46 | |
| 47 | double eps = 1.0; |
| 48 | while (true) |
| 49 | { |
| 50 | size_t i = 0; |
| 51 | for (; i < count; ++i) |
| 52 | { |
| 53 | m2::PointU p0 = PointDToPointU(arrPt[i].x, arrPt[i].y, kCoordBits); |
| 54 | m2::PointU p1 = PointDToPointU(arrPt[i].x + arrD[i].x * eps, arrPt[i].y + arrD[i].y * eps, kCoordBits); |
| 55 | |
| 56 | if (p0 != p1) |
| 57 | break; |
| 58 | } |
| 59 | if (i == count) |
| 60 | break; |
| 61 | |
| 62 | eps *= 0.1; |
| 63 | } |
| 64 | |
| 65 | LOG(LINFO, ("Epsilon (relative error) =", eps)); |
| 66 | |
| 67 | for (size_t i = 0; i < count; ++i) |
| 68 | { |
| 69 | m2::PointU const p1 = PointDToPointU(arrPt[i].x, arrPt[i].y, kCoordBits); |
| 70 | m2::PointU const p2(p1.x + arrD[i].x, p1.y + arrD[i].y); |
| 71 | m2::PointD const p3 = PointUToPointD(p2, kCoordBits); |
| 72 | |
| 73 | LOG(LINFO, ("Dx =", p3.x - arrPt[i].x, "Dy =", p3.y - arrPt[i].y)); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | UNIT_TEST(PointDToPointU_WithLimitRect) |
| 78 | { |
nothing calls this directly
no test coverage detected