-
Notifications
You must be signed in to change notification settings - Fork 3
Description
All the test files are here
For Haversin:
Before I started the work of testing:
I studied Haversine formula, as we know that haversin(θ) = sin2(θ/2) is monotonicallly
increaseing with θ in (0,π), then we can see the haversine formula:
In spherical model, r is constant value, and we calculate the length of two points, value d / r
will always in the range of (0,π), so we can simply approximately calculate length by haversine,
and we need to find the point when haversine calculation different from vincenty calculation.
I tried to create example, I fixed the first segment's starting point p1 on (0,0), and then make it's ending
point p2 active from p1's symmetrical location to approach p1, then for every p1, p2, I fixed the second
segment's first point p3 on (0, 10), then putted p4 same operation with p2.
- the code of creating test haversine case is tc_equator.cpp
- the code of tesr haversine formula is testcase_begin_equator.cpp,
I output the result if haversine calculation is different from vincenty calculation. - the input file is tc_begin_equator.in, and the output file is tc_begin_equator.out
- As we can see for segments close to equator with latitude less than 23 the haversine suffices for comparison,
For flat_approximation:
I used the same method to create test cases, but the difference is I made p3 equal to p1.
- the code of creating test flat_approximiation case is tc_equator_flat.cpp
- the code of tesr haversine formula is testcase_begin_equator_flat.cpp,
I output the result if haversine calculation is equal to vincenty calculation. - the input file is tc_begin_equator_flat.in, and the output file is tc_begin_equator_flat.out
- As we can see for segments close to equator use flat_approximiation have more complicated, may be it related to subtraction of the length of two segments, I need to make it clearer.