Use gnss geodesy instead of tender

This commit is contained in:
emanuel 2024-03-08 17:26:26 +00:00
parent 4c551d60b0
commit 4047fb21fc
3 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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;

View File

@ -4,7 +4,6 @@
#include <it2s-gnss.h>
#include <it2s-tender/epv.h>
#include <it2s-tender/space.h>
#include <it2s-tender/geodesy.h>
#include <it2s-tender/recorder.h>
#include <it2s-tender/packet.h>
#include <it2s-asn/etsi-its-sdu/itss-networking/EIS_NetworkingRequest.h>
@ -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;
}