在我的示例中,我得到了一些形成立方体并存储在Eigen::MatrixXd容器中的点,例如:
// Inline mesh of a cube
const Eigen::MatrixXd cubeV= (Eigen::MatrixXd(8,3)<<
0.0,0.0,0.0,
0.0,0.0,1.0,
0.0,1.0,0.0,
0.0,1.0,1.0,
1.0,0.0,0.0,
1.0,0.0,1.0,
1.0,1.0,0.0,
1.0,1.0,1.0).finished();
现在我想在 cgal 库中处理这些点,例如基于本教程。但是,您可以看到 cgal 函数的输入点采用以下形式:
std::vector<Pwn> points;
其中Pwn对应于:
// Types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef std::pair<Point, Vector> Pwn;
或在表单的第二个示例中:
PointList points;
再次PointList对应于:
// Types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef Kernel::Sphere_3 Sphere;
typedef std::vector<Point_with_normal> PointList;
因此,我想问我如何将我的Eigen::MatrixXd结构转换为Pwn或PointList以便我可以将它们与 cgal 功能一起使用。我知道我可以制作 for 循环并单独推回每个点,但我的猜测是应该有一种更有效或更简洁的方法来代替它。