CGAL如何合并两个stdvectorstdvectorPoint planes并附上代码
可以使用std::vector的insert函数将一个vector插入到另一个vector的末尾,如下所示:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point;
int main()
{
std::vector<std::vector<Point>> planes1 = {{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}, {{0, 0, 1}, {1, 0, 1}, {0, 1, 1}}};
std::vector<std::vector<Point>> planes2 = {{{0, 0, 2}, {1, 0, 2}, {0, 1, 2}}, {{0, 0, 3}, {1, 0, 3}, {0, 1, 3}}};
planes1.insert(planes1.end(), planes2.begin(), planes2.end());
return 0;
}
在这个例子中,我们创建了两个vector planes1和planes2,每个vector包含两个三角形。然后,我们使用insert函数将planes2插入到planes1的末尾。最后,我们可以看到planes1包含了planes2的所有元素
原文地址: https://www.cveoy.top/t/topic/cq92 著作权归作者所有。请勿转载和采集!