From 148a951e0d44577997fd2790f889dcdd7dbd6889 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期五, 17 四月 2020 17:53:18 +0800 Subject: [PATCH] 坐标 --- lib/src/main/cpp/test_items2/through_something.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/lib/src/main/cpp/test_items2/through_something.cpp b/lib/src/main/cpp/test_items2/through_something.cpp index b67e989..9461842 100644 --- a/lib/src/main/cpp/test_items2/through_something.cpp +++ b/lib/src/main/cpp/test_items2/through_something.cpp @@ -132,3 +132,37 @@ return index; } + +static void ThroughZebraCrossing(struct road_exam2_map &map, const car_model *car) +{ + for (int i = 0; i < map.specialAreas.size(); i++) { + if (map.specialAreas[i].character == 'zebra') { + double distance = 0.0; + + double yaw = YawOf(car->carXY[ car->axial[AXIAL_FRONT] ], car->carXY[ car->axial[AXIAL_REAR] ]); + PointF extPoint = PointExtend(car->carXY[ car->axial[AXIAL_FRONT] ], LASTEST_BREAK_POINT, yaw); + Line extLine; + MakeLine(&extLine, &car->carXY[ car->axial[AXIAL_FRONT] ], &extPoint); + + if (IntersectionOf(extLine, map.specialAreas[i].startLine) == GM_Intersection && + IntersectionOfLine(car->carXY[ car->axial[AXIAL_FRONT] ], map.specialAreas[i].startLine) == 1 ) { + jj = true; + if (ReadCarStatus(BREAK) == BREAK_ACTIVE) { + breakActive = 1; + } + } else { + jj = false; + } + + + + + + if (distance < LASTEST_BREAK_POINT) { + if (ReadCarStatus(BREAK) == BREAK_ACTIVE) { + breakActive = 1; + } + } + } + } +} -- Gitblit v1.8.0