ポイントをカスタム コンテナーに保存しています。これらのポイントのサブセットで Delaunay 三角形分割を作成したいと考えています。
ポイントはコンテナーに既に存在するため、ドロネー三角形分割でこれらのポイントのコピーを保存したくありません。
私のポイント クラスは Point_3 から派生し、いくつかの情報 (ブール値と整数) が含まれています。
そのために、カスタム triangulation_vertex クラスを作成しました。
template < typename GT, typename Pt, typename DSVb = Triangulation_ds_vertex_base_3<> >
class Convection_vertex : public DSVb
{
public:
typedef typename DSVb::Cell_handle Cell_handle;
typedef GT Geom_traits;
typedef typename GT::Point_3 Point;
typedef typename Pt::Point_handle Point_handle;
template < typename TDS2 >
struct Rebind_TDS {
typedef typename DSVb::template Rebind_TDS<TDS2>::Other DSVb2;
typedef Convection_vertex<GT, Pt, DSVb2> Other;
};
private:
static int rank_id;
int number_id;
bool discovered;
Point_handle _ph;
public:
Convection_vertex() : DSVb(), number_id(rank_id++), discovered(false) {}
Convection_vertex(const Point_handle& p) : DSVb(), _ph(p), number_id(rank_id++), discovered(false) {}
Convection_vertex(const Point_handle& p, const Cell_handle& c) : DSVb(c), _ph(p), number_id(rank_id++), discovered(false) {}
Convection_vertex(const Cell_handle& c) : DSVb(c), number_id(rank_id++), discovered(false) {}
const Point& point() const
{ return (*_ph); }
Point& point()
{ return (*_ph); }
void set_point(const Point& p){ }
void set_point(const Point_handle& ph)
{ _ph = ph; }
void set_point_handle(Point_handle ph)
{ _ph = ph; }
const Point_handle& point_handle() const
{ return _ph; }
Point_handle& point_handle()
{ return _ph; }
};
Delaunay 三角形分割にポイントを挿入するには、次のようにします。
DVertex_handle dvh = dt.insert(*p);
dvh->set_point_handle(p);
p は point_handle (つまり、My_point*) です。
Delaunay 三角形分割の点を削除するには、次のようにします。
dt.remove(dvh);
ここで、dvh は vertex_handle です。
三角測量へのポイントの挿入は正常に機能していますが、ポイントの削除に問題があります。カスタム頂点クラスが正しくありませんか?
それを行うより良い方法はありますか?
- 編集 - - -
dt は Delaunay 三角形分割です。
typedef CGAL::Convection_vertex<K,Point> Conv_Vb3d;
typedef CGAL::Convection_cell<K> Ce3d;
typedef CGAL::Triangulation_data_structure_3<Conv_Vb3d,Ce3d > Tds3d;
typedef CGAL::Delaunay_triangulation_3<K,Tds3d > Dh;
Dh dt;
--
@sloriot: これは良いスタートですか?
template < typename CK, bool UseStaticFilters, typename Pt >
struct Convection_traits
: public Filtered_kernel_adaptor<
Type_equality_wrapper<
typename CK:: template Base< Convection_traits<CK, UseStaticFilters,Pt> >::Type,
Convection_traits<CK, UseStaticFilters,Pt> >,
UseStaticFilters >
{
typedef Pt Point_3;
[...] // functors
};