// // BoostGeometryTools.hpp // auto_fill_jewel_v3 // // Created by Red on 2024/11/26. // 几何计算的相关代码。 #ifndef BoostGeometryTools_hpp #define BoostGeometryTools_hpp #include #include #include #include struct BoostGeometryTools { typedef boost::geometry::model::point BoostPoint;//定义点 typedef boost::geometry::model::polygon BoostPolygon;//定义多边形 typedef boost::geometry::model::box BoostBox; static bool isAIntersectsB(BoostPolygon& polyA, BoostPolygon& polyB);//检验多边形A和B是否相交 static bool isAWithinB(BoostPolygon& polyA, BoostPolygon& polyB) ;// 测试 A 在 B 的内部 static BoostPolygon makeBox( float lowerLeftX,float lowerLeftY,float wid,float hei ) ; static BoostPolygon makeRotatedBox( float lowerLeftX,float lowerLeftY,float wid,float hei,float rotdeg) ;//绕0,0点旋转 static BoostPolygon makeRotateNTranslateBox( float lowerLeftX,float lowerLeftY,float wid,float hei,float rotdeg,float dx,float dy) ;//先绕0,0点旋转,然后平移dx和dy static void rotatePoint( float x0, float y0, float rotRad, float& x1,float& y1) ;//围绕0,0点旋转一个点,rotRad使用弧度 static BoostPolygon translatePolygon(BoostPolygon& poly,float dx,float dy) ;//平移一个多边形 static BoostPolygon convex_hull(BoostPolygon& poly) ;//计算外接包裹盒子多边形 static bool pointIntersetsBox(BoostPoint& ptA,BoostPolygon& polyB) ;//检验点是否在多边形内部 } ; #endif /* BoostGeometryTools_hpp */