0
私は現在、CGALを使用して3D三角形分割を実行することを学んでおり、これまで四頂点を挿入して三角形分割することによって正四面体を作成しています。しかし、私が四面体のエッジをループし、そのエッジに対応する頂点を取得しようとすると、頂点または前のエッジの重複として原点が取得されます。 2Dではすべて正常に動作しますが、3Dでは問題が起こります。私はこれが含まれている無限の/未定義の頂点に関連していると思うが、私はこれに対処する方法を知らない。どんな助けもありがとう。CGAL三角形分割エッジイテレータには原点が含まれています
マイコード(this questionから変更):
#include <vector>
#include <iostream>
#include <cmath>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_3<K> Delaunay;
typedef K::Point_3 Point;
void load_points(std::vector<Point>& rPoints)
{
rPoints.push_back(Point(1.0, 0.0, -1.0/sqrt(2))); // first point
rPoints.push_back(Point(-1.0, 0.0, -1.0/sqrt(2))); // second point
rPoints.push_back(Point(0.0, 1.0, 1.0/sqrt(2))); // third point
rPoints.push_back(Point(0.0, -1.0, 1.0/sqrt(2))); // fourth point
}
int main()
{
std::vector<Point> points;
load_points(points);
Delaunay dt;
dt.insert(points.begin(),points.end());
for(Delaunay::Finite_edges_iterator it = dt.finite_edges_begin(); it != dt.finite_edges_end(); ++it)
{
Point i1= it->first->vertex((it->second+1)%3)->point();
Point i2= it->first->vertex((it->second+2)%3)->point();
std::cout << "i1: " << i1 << "\t i2: " << i2 << "\n";
}
return 0;
}