当前位置: 首页 > news >正文

官方网站怎样做餐饮业手机php网站

官方网站怎样做,餐饮业手机php网站,有用node.js做的网站吗,火车头wordpress教程简介 本文的代码部分都比较简单容易 Boost Geometry 是 Boost C 库集合的一部分#xff0c;定义了用于解决几何问题的概念、工具和算法。这个库比较常用#xff0c;很多现成的函数都很实用且简单#xff0c;本文记录一些常用的函数和操作#xff0c;重复的功能以后还会用到…简介 本文的代码部分都比较简单容易 Boost Geometry 是 Boost C 库集合的一部分定义了用于解决几何问题的概念、工具和算法。这个库比较常用很多现成的函数都很实用且简单本文记录一些常用的函数和操作重复的功能以后还会用到到时回来查看比阅读文档方便。 Polygon操作经常用于机器人行业的感知系统中特别是用于定义安全区域和障碍物边界框等任务。一些常见的应用包括 计算障碍物边界框与安全区域之间的重叠比例以确定危险级别。验证障碍物是否进入自动驾驶车辆的危险区域。确定一些激光雷达点是否位于指定区域内。 应用实现 需求 生成随机多边形创建两个随机多边形。有效性检查和面积计算验证多边形的有效性并计算它们的面积。相交检测确定两个多边形是否相交并在相交时计算交叉多边形。点包含检查检查指定点是否位于交叉多边形内。 代码 #include iostream #include string #include deque #include vector // To contain points #include random // Random generate points #include stdexcept// for std::runtime_error #include boost/geometry.hpp #include boost/geometry/geometries/geometries.hpp // Points, lines, polygons, etc. #include boost/geometry/geometries/point_xy.hpp // 2 D point point_xy #include boost/geometry/geometries/polygon.hpp // Polygon geometry, sequence of points for a closed loopnamespace bg boost::geometry; // Create type aliases using Point bg::model::d2::point_xydouble; using Points std::vectorPoint; using Polygon bg::model::polygonPoint;Polygon getOverlappingPolygon(const Polygon polygon_1, const Polygon polygon_2) {std::dequePolygon overlapping_polygon; // The overlapping polygon number can more than onebg::intersection(polygon_1, polygon_2, overlapping_polygon);return overlapping_polygon.front(); }bool checkPolygonIntersection(const Polygon polygon_1, const Polygon polygon_2) { return bg::covered_by(polygon_1, polygon_2) || bg::overlaps(polygon_1, polygon_2); }void printPoints(const Points points) {std::cout Generated Points: std::endl;for (const auto point : points) {std::cout ( bg::get0(point) , bg::get1(point) ) std::endl;} }Points generateRandomPoints(int num_points, double min_x, double max_x, double min_y, double max_y) {std::random_device rd;std::mt19937 gen(rd());std::uniform_real_distributiondouble dist_x(min_x, max_x);std::uniform_real_distributiondouble dist_y(min_y, max_y);Points points;for (int i 0; i num_points; i){points.push_back(Point(dist_x(gen), dist_y(gen)));}points.push_back(points.front()); // To close the loop, otherwise polygon is invalidreturn points; }Polygon generatePolygon(const Points points) {Polygon polygon;bg::assign_points(polygon, points);return polygon; }void printPolygon(const Polygon polygon, const std::string prefix ) {std::cout Polygon prefix points are: ;for (const auto point : polygon.outer()) {std::cout ( boost::geometry::get0(point) , boost::geometry::get1(point) ) ;}std::cout \t Area is: bg::area(polygon) std::endl; }Polygon generateRandomPolygon(int num_points 4, double min_x 0, double max_x 4, double min_y 0, double max_y 4) {int max_attempts 10;while(max_attempts 0){Points points generateRandomPoints(num_points, min_x, max_x, min_y, max_y);Polygon polygon generatePolygon(points);if (bg::is_valid(polygon)) // Check if the polygon is valid{return polygon;}std::cout Polygon is invalid, retrying... std::endl;max_attempts--;}throw std::runtime_error(Failed to generate a valid polygon after maximum attempts.); }int main() {Polygon polygon_1 generateRandomPolygon();printPolygon(polygon_1, 1);Polygon polygon_2 generateRandomPolygon();printPolygon(polygon_2, 2);// Check intersectionif (checkPolygonIntersection(polygon_1, polygon_2)){// Print the intersection polygon points and areaPolygon intersect_polygon getOverlappingPolygon(polygon_1, polygon_2);printPolygon(intersect_polygon, intersect);// Check if the origin point inside the polygonPoint origin {0, 0};if (bg::within(origin, polygon_1)){std::cout origin is inside the polygon std::endl;}else{std::cout origin is outside the polygon std::endl;}}else{std::cout Two polygons are not intersected std::endl;} } 一个样例输出 Polygon is invalid, retrying... Polygon is invalid, retrying... Polygon 1 points are: (1.05432, 2.2592) (1.5928, 3.05599) (2.93741, 2.09024) (1.47085, 0.798034) (1.05432, 2.2592) Area is: 2.13627 Polygon is invalid, retrying... Polygon is invalid, retrying... Polygon is invalid, retrying... Polygon 2 points are: (1.97136, 2.36949) (2.81913, 0.603898) (1.81515, 1.29083) (0.327355, 3.53608) (1.97136, 2.36949) Area is: 1.5729 Polygon intersect points are: (1.11448, 2.34822) (1.40193, 2.77356) (1.97136, 2.36949) (2.35279, 1.57512) (1.93617, 1.20803) (1.81515, 1.29083) (1.11448, 2.34822) Area is: 0.946869 origin is outside the polygon
http://www.zqtcl.cn/news/828617/

相关文章:

  • 网站建设企业有哪些内容十九届六中全会
  • 如何管理手机网站首页怎么建设一个社交网站
  • 网站规则山东网站备案网站
  • 成都网站制作龙兵科技做网站原型图用什么软件
  • 鄂州网站网站建设做网站 用哪种
  • 医药公司网站建设厦门网站建设合同
  • 网站开发全程设计注册公司哪个网站
  • 广州大型网站设计公司网站总体设计怎么写
  • 福州网站制作工具搜索引擎营销的特点是什么
  • 安徽省建设干部网站新品网络推广
  • 做网站要实名吗怎样给一个公司做网站
  • 品牌官方网站建设大航母网站建设
  • 自己做音乐网站挣钱吗网站定制公司kinglink
  • 网站建设案例新闻随州程力网站建设
  • 国外网站平台龙岩天宫山缆车收费
  • 站长工具seo综合查询是什么湖北做网站
  • 青海网站建设价格建一个免费网站的流程
  • 网站备案中 解析地址asp.net企业网站框架
  • flash里鼠标可以跟随到网站上就不能跟随了蚌埠网站建设
  • 东莞茶山网站建设网络推广方案ppt
  • 不需要写代码的网站开发软件模板之家如何免费下载
  • 购物网站模板多媒体网站开发实验报告
  • 做网站上数字快速增加上海市建设部注册中心网站
  • 义乌市网站制作青岛建设银行银行招聘网站
  • 公司网站的留言板怎么做wordpress减肥网站采集规则
  • app软件下载站seo教程wordpress实现专题
  • 在哪里自己建设网站做网站后期需要什么费用
  • 宁波网站推广怎么做微信公众号如何运营与推广
  • 做网站开发语言农产品品牌建设
  • 百度一下你就知道官方网站做准考证的网站