某些 CGAL 示例(例如射流平滑和法线方向)无法编译
Some CGAL examples (e.g. Jet Smoothing and Normal Orientation) fail to compile
我目前正在从事一个项目,在这个项目中,使用一些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 中产生了此错误。
就其价值而言,异常值删除示例以及输入/输出示例可以正确编译和执行。
在这一点上,我感到有些卡住,并希望得到任何帮助。
在 git 中查看了<CGAL/jet_smooth_point_set.h>
,位于
jet_smooth_point_set.h
我发现最后 2 个参数是默认值的 5 参数重载,在第 320 行定义,
template <typename Concurrency_tag,
typename InputIterator>
void jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
unsigned int k, ///< number of neighbors.
const unsigned int degree_fitting = 2,
const unsigned int degree_monge = 2)
在示例代码中使用,在第 263 行被以下#ifdef
包围:
#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
因此,我得出的结论是,CGAL 是在没有上述两个库 Eigen3 和 LAPACK 的情况下构建的。尝试使用其中任何一个支持来重建 CGAL(请注意#ifdef
中的||
条件运算符(。为此,请安装相应的软件包以及devel
软件包(我是RedHat的人,所以不知道Ubuntu如何拆分开发和非开发软件包(。您希望安装这些库的标头以针对它们编译 CGAl。然后,重新运行 cmake,确保它找到库(调用ccmake
或密切观察 cmake 配置输出,例如"找到 Eigen3"(并重建 CGAL。