【问题标题】:CGAL - Polyhedron dijkstra shortest pathCGAL - 多面体 dijkstra 最短路径
【发布时间】:2014-04-11 09:19:42
【问题描述】:

我发现对于 BGL 计算

CGAL::Polyhedron_3<K,CGAL::Polyhedron_items_with_id_3>

平方距离用于边缘权重,定义在: CGAL/boost/graph/properties_Polyhedron_3.h

这会在多面体网格上产生错误的结果。

如何在不更改 CGAL 代码的情况下更改重量指标?

我的解决方法是改变

reference operator[](key_type const& e) const
  {
    return CGAL::squared_distance(e->vertex()->point(), e->opposite()->vertex()->point());
  }

在 Polyhedron_edge_weight_map 类中

reference operator[](key_type const& e) const
  {
    return sqrt(CGAL::squared_distance(e->vertex()->point(), e->opposite()->vertex()->point()));
  }

有什么想法吗?

谢谢,最好的, 托马斯

【问题讨论】:

    标签: cgal


    【解决方案1】:

    注意weightmap是函数dijksta_shortest_path的参数

    【讨论】:

    • 你知道如何为多面体的权重图分配权重吗?我用 get(boost::edge_weight, polyhedron) 试过了,但我只能读取值而不能写入。
    猜你喜欢
    • 2014-08-07
    • 1970-01-01
    • 2015-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多