ドロネー三角形分割を行った後に色にアクセスできるように、CGALのPoint_3クラスに色変数(unsigned char)を追加しようとしています。
私が試したのは、Triangulation_vertex_base_with_info_3を使用して、このような色を保存することです(http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3/Chapter_main.html#Subsection_39.5.3の例に従ってください)
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<unsigned char, K> Vb;
typedef CGAL::Triangulation_data_structure_3<Vb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Triangulation;
typedef Triangulation::Point CGAL_Point;
//...
//here I make a vector of pairs of points and their color
std::vector<std::pair<CGAL_Point, unsigned char> > points;
Point currentPoint;
for (int i=0; i<roiPoints.size(); i++){
currentPoint=roiPoints[i];
points.push_back(std::make_pair(CGAL_Point(currentPoint.x, currentPoint.y, currentPoint.z), roiColors[i]));
}
//...
//triangulation
T.clear();
T.insert(points.begin(), points.end());
私が実際に達成したいのは、三角測量を行った後、Triangulation::Tetrahedronクラスを介して頂点の色にアクセスできるようにすることです。
(x、y、z)に点Pがあるとしましょう。三角測量の後、この点Pを含む四面体tを見つけ、この四面体の頂点にアクセスできます(t.vertex(0..3)を使用)。これにより、Point_3タイプの頂点が返され、以前に保存した色にアクセスできません。
これを行う方法は、色情報を含む独自のPointクラスを作成することだと思います。簡単ですが、Point_3の代わりにこのクラスを使用する方法がわかりません。これを行うには独自のカーネルとhttp://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23/Chapter_main.html#Section_11.5の例も作成する必要があることがわかりましたが、できません。基本クラスとしてどのカーネルを使用する必要があるか、またはカーネルにどの関数を含める必要があるかを把握します。
私はここstackoverflowで2つの同様のトピックを見つけました: 私自身のPointクラス と CGALでのCGALカーネルのカスタマイズ:継承とカーネル ですが、それらは私を助けませんでした。
ご協力ありがとうございました!