123456789101112131415161718192021222324252627282930313233343536373839 |
- /*
- * @Description:
- * @Version: 1.0
- * @Autor: Sun Yalun
- * @Date: 2024-11-04 15:38:06
- * @LastEditors: Sun Yalun
- * @LastEditTime: 2024-11-08 14:39:18
- */
- // lib/utils.h
- #ifndef UTILS_H
- #define UTILS_H
- #include "engine.h"
- #include <string>
- #include <vector>
- struct BoundingBox {
- double min_x, max_x;
- double min_y, max_y;
- };
- BoundingBox createBoundingBox(const Point& p1, const Point& p2);
- bool isPointInBoundingBox(const Point& p, const BoundingBox& box);
- std::vector<int> parseRef(const std::string& ref_str);
- std::vector<Point> parseCoords(const std::string& coords_str);
- std::vector<InterInfo> readIntersectionsFromCSV(const std::string& csvPath);
- std::vector<CrosswalkInfo> readCrosswalksFromCSV(const std::string& csvPath);
- std::vector<TrafficlightInfo> readTrafficlightsFromCSV(const std::string& csvPath);
- std::vector<RoadInfo> readRoadsFromCSV(const std::string& csvPath);
- std::vector<LaneInfo> readLanesFromCSV(const std::string& csvPath);
- std::vector<SignalInfo> readSignalsFromCSV(const std::string& csvPath);
- std::vector<StoplineInfo> readStopLinesFromCSV(const std::string& csvPath);
- std::vector<ArrowInfo> readArrowsFromCSV(const std::string& csvPath);
- double calculateDistance(double x1, double y1, double x2, double y2);
- double pointToSegmentDistance(const Point& p, const Point& p1, const Point& p2);
- double computeMinDistanceToCurve(const Point& queryPoint, const std::vector<Point>& curve, size_t window_size=10);
- double computeBazierDistanceToCurve(const Point& queryPoint, const std::vector<Point>& coords);
- Point calculateCentroid(const std::vector<Point>& coords);
- #endif // UTILS_H
|