Subject: CGAL users discussion list
List archive
- From: Ben Supnik <>
- To:
- Subject: [cgal-discuss] Sweep_line_2 with beziers
- Date: Thu, 16 Apr 2009 10:47:33 -0400
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);
--
Scenery Home Page: http://scenery.x-plane.com/
Scenery blog: http://xplanescenery.blogspot.com/
Plugin SDK: http://www.xsquawkbox.net/xpsdk/
X-Plane Wiki: http://wiki.x-plane.com/
Scenery mailing list:
Developer mailing list:
- [cgal-discuss] Sweep_line_2 with beziers, Ben Supnik, 04/16/2009
- [cgal-discuss] intersection of curves, Khuong Vu, 04/16/2009
- Re: [cgal-discuss] Sweep_line_2 with beziers, Efraim Fogel, 04/21/2009
Archive powered by MHonArc 2.6.16.