From 3a48a0de38910517352557510882f2ff4d8436ae Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期五, 20 三月 2020 18:05:55 +0800 Subject: [PATCH] 路考 --- lib/src/main/cpp/test_items2/road_exam.cpp | 41 +++++++++++++++++++++++++++++++++-------- 1 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/src/main/cpp/test_items2/road_exam.cpp b/lib/src/main/cpp/test_items2/road_exam.cpp index fd723b9..5e1f915 100644 --- a/lib/src/main/cpp/test_items2/road_exam.cpp +++ b/lib/src/main/cpp/test_items2/road_exam.cpp @@ -10,6 +10,7 @@ #include "../defs.h" #include "../test_common/car_sensor.h" #include "../native-lib.h" +#include "through_something.h" #include <vector> #include <list> @@ -400,14 +401,38 @@ if (currExamMapIndex == -1) { currExamMapIndex = CrashTriggerLine(RoadMapList, car, CarModelList); if (currExamMapIndex != -1) { - DEBUG("杩涘叆璺�冨瓙鍦板浘 index = %d id = %d item = %d", currExamMapIndex, RoadMapList[currExamMapIndex].id, RoadMapList[currExamMapIndex].type); - if (!RoadMapList[currExamMapIndex].tts.empty()) { - PlayTTS(RoadMapList[currExamMapIndex].tts.c_str(), 0); - } + StartThroughExam(currExamMapIndex, RoadMapList); } } else { } +} + +bool ExitSonArea(int index, LIST_ROAD_MAP &RoadMapList, const car_model *car) +{ + bool ret = false; + + if (index < 0 || index > RoadMapList.size()) + return true; + + if (RoadMapList[index].area.point != NULL) { + // 闇�瑕佽溅韬叏閮ㄧ寮� + Polygon carBody; + + carBody.num = car->bodyNum; + carBody.point = (PointF *)malloc(carBody.num * sizeof(PointF)); + for (int i = 0; i < carBody.num; ++i) { + carBody.point[i] = car->carXY[car->body[i]]; + } + + if (IntersectionOf(&carBody, &RoadMapList[index].area) == GM_None) { + ret = true; + } + + free(carBody.point); + } + + return ret; } static void Rtk2DriveTimer(struct drive_timer &tm, const struct RtkTime *rtkTime) @@ -494,7 +519,7 @@ MakeLine(&rearAxle, &car->carXY[car->left_rear_tire[TIRE_OUTSIDE]], &car->carXY[car->right_rear_tire[TIRE_OUTSIDE]]); for (int i = 0; i < RoadMapList.size(); ++i) { - if (RoadMapList[i].type == 100) { + if (RoadMapList[i].type == GENERAL_MAP) { // 姣忔潯绾块兘妫�娴� for (int j = 0; j < RoadMapList[i].redLineNum; ++j) { @@ -536,7 +561,7 @@ } for (int i = 0; i < RoadMapList.size(); ++i) { - if (RoadMapList[i].type == 100) { + if (RoadMapList[i].type == GENERAL_MAP) { // 姣忔潯绾㈠尯閮芥娴� for (int j = 0; j < RoadMapList[i].redAreaNum; ++j) { @@ -566,7 +591,7 @@ MakeLine(&rearAxle, &car->carXY[car->left_rear_tire[TIRE_OUTSIDE]], &car->carXY[car->right_rear_tire[TIRE_OUTSIDE]]); for (int i = 0; i < RoadMapList.size(); ++i) { - if (RoadMapList[i].type == 100) { + if (RoadMapList[i].type == GENERAL_MAP) { // 姣忔潯绾块兘妫�娴� for (int j = 0; j < RoadMapList[i].greenLineNum; ++j) { @@ -621,7 +646,7 @@ } for (int i = 0; i < RoadMapList.size(); ++i) { - if (RoadMapList[i].type == 100) { + if (RoadMapList[i].type == GENERAL_MAP) { // 姣忔潯绾块兘妫�娴� for (int j = 0; j < RoadMapList[i].triggerLineNum; ++j) { -- Gitblit v1.8.0