Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Sweep_line_2 with beziers

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Sweep_line_2 with beziers


Chronological Thread 
  • From: Efraim Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] Sweep_line_2 with beziers
  • Date: Tue, 21 Apr 2009 15:49:44 +0300

In the example, there is a call to CGAL::get_intersection_points().However, in the more recent version this call does not exist, as it has been replaced by CGAL::compute_intersection_points().

I suspect you are using an older version, which may be buggy. We tested the code with the new version and it works fine.

P.S.
In the original example code there is a problem with the printf() call, and the argument *n,* should be added after the format string in order to get a proper output.

Ben Supnik wrote:
Hi Y'all,

I am using get_intersection_points_2 to try to find all places where bezier curves intersect each other (excluding end-points) - I am using the standard bezier curve traits from the arrangement package (e.g. from the demo code) with CORE for my numeric type.

The surprising result is that if I pass in 4 curves (each with only two control points, so they are really line segments) I get an assertion failure at Bezier_bounding_rational_trait:247... there are 5 intersection pairs, not just 1.

My "curves" are really quite boring...just a bow-tie shape.

Are there any known gotchas here? I've posted a heavily cut down sample reproducer here:

http://dev.x-plane.com/download/test_bez.cpp

"interesting" part of the code is at the end of the email. The output gives me:

CGAL error: assertion violation!
Expr: intersection_pairs.size() == 1
File: ../../libs/local/include/CGAL/Arr_traits_2/Bezier_bounding_rational_traits.h
Line: 247
Explanation:
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: intersection_pairs.size() == 1
File: ../../libs/local/include/CGAL/Arr_traits_2/Bezier_bounding_rational_traits.h
Line: 247
Abort trap
mac-pro:XESTools bsupnik$ scp test_bez.cpp :/shared/download/test_bez.cpp

Anyway, if I am doing something really, really idiotic, please let me know!!

cheers
ben


vector<Rat_point_2> c;
vector<Bezier_curve_2> curves;
vector<Bezier_point_2> p;
c.resize(2);
c[0] = Rat_point_2(-71.026688,42.395582);
c[1] = Rat_point_2(-71.011037,42.396439);
curves.push_back(Bezier_curve_2(c.begin(),c.end()));

c[0] = Rat_point_2(-71.011037,42.396439);
c[1] = Rat_point_2(-71.010892,42.390653);
curves.push_back(Bezier_curve_2(c.begin(),c.end()));

c[0] = Rat_point_2(-71.010892,42.390653);
c[1] = Rat_point_2(-71.022341,42.400083);
curves.push_back(Bezier_curve_2(c.begin(),c.end()));

c[0] = Rat_point_2(-71.022341,42.400083);
c[1] = Rat_point_2(-71.026688,42.395582);
curves.push_back(Bezier_curve_2(c.begin(),c.end()));

Bezier_traits_2 traits;
CGAL::get_intersection_points(curves.begin(),curves.end(),
back_inserter(p), false, traits);
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/




Archive powered by MHonArc 2.6.16.

Top of Page