diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f907f06..ff4b4e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,6 +21,7 @@ TARGET_LINK_LIBRARIES(it2s-itss-facilities -lit2s-asn-etsi-its-sdu-itss-networking -lit2s-asn-etsi-its-sdu-cdd-1.3.1 -lzmq + -lit2s_gnss -lpthread -lit2s-config-etsi-its -lit2s-asn-etsi-its-v1-cdd-1.3.1 diff --git a/src/tpm.c b/src/tpm.c index 0e5a1e4..0712158 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -33,7 +33,7 @@ int tpm_is_inside_zone(tolling_info_t* ti) { heading = epv.space.data.heading.value; itss_space_unlock(); - if (itss_is_inside_polygon(point, ti->zone.polygon, ti->zone.polygon_len)) { + if (it2s_geodesy_inside_polygon(point[0], point[1], ti->zone.polygon, ti->zone.polygon_len)) { uint16_t da = abs((int16_t)heading - (int16_t)ti->asn->angle); if (da <= 900 || da >= 2700) { return 1; diff --git a/src/vcm.c b/src/vcm.c index 3301140..a878e06 100644 --- a/src/vcm.c +++ b/src/vcm.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -23,24 +22,28 @@ static int do_paths_intersect( /* TODO this can be made way more efficient */ double A1[2], A2[2], B1[2], B2[2]; + double A[2][2], B[2][2]; uint64_t tsA, tsB; for (int a = 0; a < tA_len-1; ++a) { A1[0] = tA[a].latitude; A1[1] = tA[a].longitude; A2[0] = tA[a+1].latitude; A2[1] = tA[a+1].longitude; + double A[2][2] = { + {tA[a].latitude, tA[a].longitude}, + {tA[a+1].latitude, tA[a+1].longitude} + }; for (int b = 0; b < tB_len-1; ++b) { if (tA[a].timestamp > tB[b].timestamp + 2000 || tA[a].timestamp < tB[b].timestamp - 2000) { continue; } + double B[2][2] = { + {tB[b].latitude, tB[b].longitude}, + {tB[b+1].latitude, tB[b+1].longitude} + }; - B1[0] = tB[b].latitude; - B1[1] = tB[b].longitude; - B2[0] = tB[b+1].latitude; - B2[1] = tB[b+1].longitude; - - if (itss_do_segments_intersect(A1, A2, B1, B2)) { + if (it2s_geodesy_segments_intersect(&A, &B)) { *index = a; return 1; }