Je voudrais utiliser une classe de points personnalisée avec la triangulation de contrainte limitée CGAL. Cependant, avec la classe MyPoint suivante (qui devrait se comporter exactement comme un CGAL :: Point_2 non?), J'obtiens des fautes de segmentation. Cela fonctionne parfaitement si je mets le typedef Point_2 dans MyKernel à CGAL :: Exact_predicates_inexact_constructions_kernel :: Point_2. Qu'est-ce que je fais mal?Personnalisation du noyau CGAL avec ma propre classe de points
template<class P>
struct MyPoint : public P {
MyPoint() : P() {}
MyPoint(const MyPoint& p) : P(p) {}
MyPoint(int x, int y) : P(x,y) {}
MyPoint(double x, double y) : P(x,y) {}
};
struct MyKernel : CGAL::Exact_predicates_inexact_constructions_kernel {
typedef MyPoint<CGAL::Exact_predicates_inexact_constructions_kernel::Point_2> Point_2;
};
typedef MyKernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
typedef CDT::Point Point;
Code qui segfaults à la dernière ligne:
CDT cdt;
Point cgal_p1;
Point cgal_p2;
cgal_p1 = Point(p1[1],p1[2]);
cgal_p2 = Point(p2[1],p2[2]);
cdt.insert_constraint(cgal_p1,
cgal_p2);