C++ CGAL:查找点所属的面/三角形?
在阅读了相关内容后,我得出以下结论:C++ CGAL:查找点所属的面/三角形?,c++,computational-geometry,triangulation,cgal,delaunay,C++,Computational Geometry,Triangulation,Cgal,Delaunay,在阅读了相关内容后,我得出以下结论: #include <vector> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_2.h> typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Delaunay_t
#include <vector>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
typedef K::Point_2 Point;
void load_points(std::vector< Point >& points)
{
points.push_back(Point(1., 1.));
points.push_back(Point(2., 1.));
points.push_back(Point(2., 2.));
points.push_back(Point(1., 2.));
}
int main()
{
std::vector< Point > points;
load_points(points);
Delaunay dt;
dt.insert(points.begin(), points.end());
std::cout << dt.number_of_vertices() << std::endl;
typedef std::vector<Delaunay::Face_handle> Faces;
Faces faces;
std::back_insert_iterator<Faces> result( faces );
result = dt.get_conflicts ( Delaunay::Point(1.5, 1.5),
std::back_inserter(faces) );
return 0;
}
#包括
#包括
#包括
typedef CGAL::精确谓词不精确结构内核K;
typedef CGAL::Delaunay_三角剖分_2Delaunay;
类型定义K::点2点;
无效荷载点(标准::向量<点>&点)
{
点。向后推(点(1,1.);
点。向后推(点(2,1.);
点。向后推(点(2,2.);
点。向后推(点(1,2));
}
int main()
{
标准::向量<点>点;
荷载点(点);
德洛奈;
插入(points.begin(),points.end());
std::cout您应该使用locate member函数来查找文档
CGAL::Triangle_2<K> f = dt.triangle(faces[0]);
std::cout << dt.triangle(faces[0]) << std::endl;
std::cout << dt.triangle(faces[1]) << std::endl;