You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改boost::geometry::polygon中的顶点?

Boost Geometry多边形顶点修改问题

我使用以下代码从boost::geometry::polygon中获取顶点:

using namespace boost::geometry;
using PointType = model::d2::point_xy<double>;
using PolygonType = model::polygon<PointType, false>;   // 顺时针排序

PolygonType poly;
// 此处设置多个顶点
for(auto pos = 0; pos < num_points(poly); ++pos) {
    PointType pt = poly.outer()[pos];
    // 此处对点进行操作
}   

原本我找不到简便的方法修改多边形中特定顶点的值,误以为以下代码无法生效:

PointType new_pt{3, 3};
poly.outer()[pos] = new_pt;

实际上这段代码是有效的。


内容的提问来源于stack exchange,提问作者Andrew Bond

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 22:27:35