使用 CGAL SDF 算法提升误差
Boost error with CGAL SDF algorithm
我目前正在尝试使用 CGAL 的 SDF 算法,但我有一些提升错误,我不知道它来自哪里。我遵循了 CGAL doc
中的示例代码
这是我的代码部分:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/mesh_segmentation.h>
#include <CGAL/property_map.h>
[...]
void ShapeDiameterFunction_Component::SDF_Algorithm(PolyhedronPtr pMesh)
{
pMesh->triangulate();
srand((unsigned)time(NULL));
// create a property-map for segment-ids
typedef std::map<Polyhedron::Facet_const_handle, std::size_t> Facet_int_map;
Facet_int_map internal_segment_map;
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
// calculate SDF values and segment the mesh using default parameters.
std::size_t number_of_segments = CGAL::segmentation_via_sdf_values(pMesh, segment_property_map);
std::cout << "Number of segments: " << number_of_segments << std::endl;
}
我在使用 "segmentation_via_sdf_values" 函数时遇到错误:
/usr/include/boost/mpl/eval_if.hpp|38|error: no type named ‘type’ in ‘boost::mpl::eval_if<boost::detail::has_vertex_property_type<boost::shared_ptr<Enriched_polyhedron<CGAL::Simple_cartesian<double>, Enriched_items> >, mpl_::bool_<false> >, boost::detail::get_vertex_property_type<boost::shared_ptr<Enriched_polyhedron<CGAL::Simple_cartesian<double>, Enriched_items> > >, boost::no_property>::f_ {aka struct boost::no_property}’|
我不知道它是来自我的 boost 安装还是来自代码本身。
我正在使用 1.55 版的 libboost-dev 和 4.5.2 版的 CGAL。
我使用的是 Ubuntu 15.04 版本,我的编译器是 GCC 编译器 4.9.2.
我尝试了 CGAL 文档中的示例是另一个项目,它确实编译了。
[编辑] 这是我的编译器 log。
谢谢,
玉米弹性体
我发现了我的问题,我使用的是使用 CGAL 库的 MEPP 库。 MEPP 库正在重新定义 "Polyhedron" 的 typedef 声明,并且发送到 sdf_values 函数的 "pMesh" 与想要的 "Polyhedron" 类型不同。
当然,类型是用 boost (eval_if) 检查的,这就是它给我这个错误的原因。
typedef CGAL::Exact_predicates_inexact_constructions_kernel KernelSDF;
typedef CGAL::Polyhedron_3<KernelSDF> PolyhedronSDF;
PolyhedronSDF mesh;
typedef std::map< PolyhedronSDF::Facet_const_handle, double> Facet_double_map;
Facet_double_map internal_map;
boost::associative_property_map<Facet_double_map> sdf_property_map(internal_map);
// compute SDF values
std::pair<double, double> min_max_sdf = CGAL::sdf_values(mesh, sdf_property_map);
现在我只需要将我的 pMesh 复制到我的网格对象中!
谢谢。
我目前正在尝试使用 CGAL 的 SDF 算法,但我有一些提升错误,我不知道它来自哪里。我遵循了 CGAL doc
中的示例代码这是我的代码部分:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/mesh_segmentation.h>
#include <CGAL/property_map.h>
[...]
void ShapeDiameterFunction_Component::SDF_Algorithm(PolyhedronPtr pMesh)
{
pMesh->triangulate();
srand((unsigned)time(NULL));
// create a property-map for segment-ids
typedef std::map<Polyhedron::Facet_const_handle, std::size_t> Facet_int_map;
Facet_int_map internal_segment_map;
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
// calculate SDF values and segment the mesh using default parameters.
std::size_t number_of_segments = CGAL::segmentation_via_sdf_values(pMesh, segment_property_map);
std::cout << "Number of segments: " << number_of_segments << std::endl;
}
我在使用 "segmentation_via_sdf_values" 函数时遇到错误:
/usr/include/boost/mpl/eval_if.hpp|38|error: no type named ‘type’ in ‘boost::mpl::eval_if<boost::detail::has_vertex_property_type<boost::shared_ptr<Enriched_polyhedron<CGAL::Simple_cartesian<double>, Enriched_items> >, mpl_::bool_<false> >, boost::detail::get_vertex_property_type<boost::shared_ptr<Enriched_polyhedron<CGAL::Simple_cartesian<double>, Enriched_items> > >, boost::no_property>::f_ {aka struct boost::no_property}’|
我不知道它是来自我的 boost 安装还是来自代码本身。 我正在使用 1.55 版的 libboost-dev 和 4.5.2 版的 CGAL。 我使用的是 Ubuntu 15.04 版本,我的编译器是 GCC 编译器 4.9.2.
我尝试了 CGAL 文档中的示例是另一个项目,它确实编译了。
[编辑] 这是我的编译器 log。
谢谢, 玉米弹性体
我发现了我的问题,我使用的是使用 CGAL 库的 MEPP 库。 MEPP 库正在重新定义 "Polyhedron" 的 typedef 声明,并且发送到 sdf_values 函数的 "pMesh" 与想要的 "Polyhedron" 类型不同。 当然,类型是用 boost (eval_if) 检查的,这就是它给我这个错误的原因。
typedef CGAL::Exact_predicates_inexact_constructions_kernel KernelSDF;
typedef CGAL::Polyhedron_3<KernelSDF> PolyhedronSDF;
PolyhedronSDF mesh;
typedef std::map< PolyhedronSDF::Facet_const_handle, double> Facet_double_map;
Facet_double_map internal_map;
boost::associative_property_map<Facet_double_map> sdf_property_map(internal_map);
// compute SDF values
std::pair<double, double> min_max_sdf = CGAL::sdf_values(mesh, sdf_property_map);
现在我只需要将我的 pMesh 复制到我的网格对象中!
谢谢。