#include "task_communication.h" // 定义测试函数 void test_isPointInPolygon() { // 定义多边形的经纬度坐标集合 double polygonLat[] = {34.34934, 34.25916, 34.36221, 34.21619}; double polygonLng[] = {108.84569, 108.80257, 109.03829, 109.05611}; // 测试点在多边形内部的情况 double point1Lat = 34.33312; double point1Lng = 108.8531; bool result1 = isPointInPolygon(point1Lat, point1Lng, polygonLat, polygonLng); printf("Test case 1: Point (%f, %f) is%s inside the polygon.\n", point1Lat, point1Lng, result1 ? "" : " not"); double point2Lat = 34.20520; double point2Lng = 108.93078; bool result2 = isPointInPolygon(point2Lat, point2Lng, polygonLat, polygonLng); printf("Test case 2: Point (%f, %f) is%s inside the polygon.\n", point2Lat, point2Lng, result2 ? "" : " not"); // 测试点在多边形边上的情况 double point3Lat = 34.23195; double point3Lng = 108.81235; bool result3 = isPointInPolygon(point3Lat, point3Lng, polygonLat, polygonLng); printf("Test case 3: Point (%f, %f) is%s on the polygon edge.\n", point3Lat, point3Lng, result3 ? "" : " not"); // 测试点在多边形外部的情况 double point4Lat = 34.26728; double point4Lng = 108.78992; bool result4 = isPointInPolygon(point4Lat, point4Lng, polygonLat, polygonLng); printf("Test case 4: Point (%f, %f) is%s outside the polygon.\n", point4Lat, point4Lng, result4 ? "" : " not"); } /* USER CODE BEGIN Header_Task_communication */ /** * @brief Function implementing the communication thread. * @param argument: Not used * @retval None */ /* USER CODE END Header_Task_communication */ void task_communication_content(void) { // unsigned long times = 0; LED0_TOGGLE(); // 灯翻转 // test_isPointInPolygon(); // times = getRunTimeCounterValue(); // printf("test_isPointInPolygon:%ld\r\n", times); osDelay(1000); }