【发布时间】:2016-02-04 11:09:37
【问题描述】:
我目前正在开展一个项目,在该项目中,使用一些 CGAL 算法进行点集处理将非常有利。
除其他外,我需要运行喷射平滑算法 - 示例如下: http://doc.cgal.org/latest/Point_set_processing_3/
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/jet_smooth_point_set.h>
#include <vector>
// types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
int main(void)
{
// generate point set
std::vector<Point> points;
points.push_back(Point( 0.0, 0.0, 0.001));
points.push_back(Point(-0.1,-0.1, 0.002));
points.push_back(Point(-0.1,-0.2, 0.001));
points.push_back(Point(-0.1, 0.1, 0.002));
points.push_back(Point( 0.1,-0.1, 0.000));
points.push_back(Point( 0.1, 0.2, 0.001));
points.push_back(Point( 0.2, 0.0, 0.002));
points.push_back(Point( 0.2, 0.1, 0.000));
points.push_back(Point( 0.0,-0.1, 0.001));
// Smoothing.
const unsigned int nb_neighbors = 8; // default is 24 for real-life point sets
CGAL::jet_smooth_point_set(points.begin(), points.end(), nb_neighbors);
return EXIT_SUCCESS;
}
编译时(使用 CMake),我遇到以下错误:
error: no matching function for call to ‘jet_smooth_point_set(std::vector<CGAL::Point_3<CGAL::Epick> >::iterator, std::vector<CGAL::Point_3<CGAL::Epick> >::iterator, const unsigned int&)’
CGAL::jet_smooth_point_set(points.begin(), points.end(), nb_neighbors);
jet_smooth_point_set.h:177:1: note: candidate: template<class Concurrency_tag, class InputIterator, class PointPMap, class Kernel, class SvdTraits> void CGAL::jet_smooth_point_set(InputIterator, InputIterator, PointPMap, unsigned int, const Kernel&, unsigned int, unsigned int)
note: candidate expects 7 arguments, 3 provided
CGAL::jet_smooth_point_set(points.begin(), points.end(), nb_neighbors);
错误似乎暗示包含的头文件中没有指定函数?然而,标题的位置似乎正确?
CGAL 存储库附带的示例中也会出现同样的问题。
我的设置是 Ubuntu 15.10、GCC 5.2.1、CMake 3.2.2,我使用 Ubuntu 存储库中的 CGAL 4.6 和从 Github 存储库编译的 CGAL 4.8-beta 产生了这个错误。
不管怎样,异常值删除示例以及输入/输出示例都能正确编译和执行。
我觉得有点卡在这一点上,希望能得到任何帮助。
【问题讨论】:
-
并行版本将在 CGAL-4.8 中添加。请参阅this 更新示例。但是,该代码应该适用于 4.7 及更早版本。
-
谢谢;是的,我偶然发现了该示例的并行版本。但是,如下所述,问题似乎是我没有设法将 Eigen3 包含在我的 CGAL 编译中。
-
那么,如果您使用的是 cmake,则缺少 `find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) include( ${EIGEN3_USE_FILE} ) endif()
. If not but your compiler knows where to find eigen, simply defineCGAL_EIGEN3_ENABLED`,如文档所述@ 987654323@ -
谢谢 - 正如您在 cmets 中看到的答案,我已经包含 Eigen3,并且我的编译器确实找到了 Eigen3_use_file。我还尝试过定义 CGAL_EIGEN3_ENABLED。在编译相关示例时,它会导致以下错误: CGAL/Kernel_23/include/CGAL/Dimension.h:28:22: fatal error: Eigen/Core: No such file or directory ,这对我来说意味着 EIgen3 有实际上没有正确编译?
-
Eigen 是一个只有头文件的库,你只需要将它添加到编译器的包含目录中