Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Segfault when customizing Point class used in triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Segfault when customizing Point class used in triangulation


Chronological Thread 
  • From: Ramin H <>
  • To:
  • Subject: Re: [cgal-discuss] Segfault when customizing Point class used in triangulation
  • Date: Thu, 18 Mar 2010 15:10:13 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=q/tAwsIy4xBx4RE+3WjuOPrHkLDkEd+LkzoS3p3JTrp3usS6c8y3aChx18V7KE/Rbs 6HdqpHPmNfPSJwP42vtR+APd8WMQjpzx6/clu6QP9rabYkboxiXUiKTCk/sgy1DNR0jn FNdb3ASwTqcAQ3O5q7MyOrbeJ0aMku4RFc/vE=

I believe CGAL's triangulation data structure uses weighted points.

http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_1301

http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Triangulation_2/Chapter_main.html

-Ramin


On Thu, Mar 18, 2010 at 2:11 PM, MHOOO <> wrote:

I would like to use a custom Point class with the CGAL constrained delaunay
triangulation. However, with the following MyPoint class (which should
behave the exact same as a CGAL::Point_2 no?) I get segmentation faults
inside insert_constraint (with a backtrace of several thousands of function
calls). It works perfectly if I set the Point_2 typedef inside MyKernel to
CGAL::Exact_predicates_inexact_constructions_kernel::Point_2. What am I
doing wrong?

----------------------------------------------------
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;

// ...
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);
----------------------------------------------------
--
View this message in context: http://n4.nabble.com/Segfault-when-customizing-Point-class-used-in-triangulation-tp1598397p1598397.html
Sent from the cgal-discuss mailing list archive at Nabble.com.

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss





Archive powered by MHonArc 2.6.16.

Top of Page