Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2
Chronological Thread
- From: Efraim Fogel <>
- To:
- Subject: Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2
- Date: Mon, 12 Oct 2009 11:38:13 +0200
You are trying to do something that is currently not supported, but
there is a simple workaround.
The manual of compute_intersection_points() says, and I quote "The
Traits type must be a model of the ArrangementTraits_2 concept, such
that the value-type of InputIterator is Traits::Curve_2". Gps_traits_2
does not model the ArrangementTraits_2 concept. As a matter of fact, it
doesn't even define the nested type Curve_2, which is required to be the
value type of the iterators that you pass as input parameters to the
compute_intersection_points() function.
You need to define your input curves as Conic_traits_2::Curve_2. You
will notice that Conic_traits_2::Curve_2 does not have a constructor
that accepts two points. Instead you need to provide the entire set of 6
coefficients that define a general conic, and the endpoints, (which you
have). The first 3 should be zero, and the remaining three are the
coefficients of the underlying line.
Notice that compute_intersection_points() accepts the traits as an
optional parameter. It might be easier to debug if you pass it
explicitly, as in:
Conic_traits_2 traits;
compute_intersection_points(iss, iss+1, std::back_inserter (pts),
false, traits);
zickphy wrote:
> Hi, Thanks for your reply.
> The relevant code is all included here. It is simple, but I do not know what
> wrong with this.
>
> -------------------------------------------------------------
> #include <CGAL/basic.h>
> #include <CGAL/Timer.h>
> #include <CGAL/Cartesian.h>
> #include <CGAL/CORE_algebraic_number_traits.h>
> #include <CGAL/offset_polygon_2.h>
> #include <CGAL/Arr_conic_traits_2.h>
> #include <CGAL/Sweep_line_2_algorithms.h>
>
> typedef CGAL::CORE_algebraic_number_traits Nt_traits;
> typedef Nt_traits::Rational Rational;
> typedef Nt_traits::Algebraic Algebraic;
> //struct Rat_kernel : public CGAL::Cartesian<Rational> {};
> //struct Alg_kernel : public CGAL::Cartesian<Algebraic> {};
> //struct Conic_traits_2 : public CGAL::Arr_conic_traits_2<Rat_kernel,
> Alg_kernel, Nt_traits> {};
> typedef CGAL::Cartesian<Rational> Rat_kernel;
> typedef CGAL::Cartesian<Algebraic> Alg_kernel;
> typedef CGAL::Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
> Conic_traits_2;
> typedef Rat_kernel::Point_2 Point_2;
> typedef CGAL::Polygon_2<Rat_kernel> Polygon_2;
> typedef CGAL::Gps_traits_2<Conic_traits_2> Gps_traits_2;
> typedef Gps_traits_2::Polygon_2 Offset_polygon_2;
> typedef Gps_traits_2::Polygon_with_holes_2 Offset_polygon_with_holes_2;
> typedef Gps_traits_2::X_monotone_curve_2 X_monotone_curve_2;
> typedef CGAL::Arrangement_2<Gps_traits_2> Arrangement_2;
> typedef Gps_traits_2::Point_2 Query_Point_2;
>
> using namespace std;
>
> void main()
> {
> Query_Point_2 pt1(0, 0);
> Query_Point_2 pt2(0, 10);
> Query_Point_2 pt3(10, 0);
> Query_Point_2 pt4(0, 10);
> std::list<Query_Point_2> pts;
> X_monotone_curve_2 is1(pt1, pt2);
> X_monotone_curve_2 is2(pt3, pt4);
> X_monotone_curve_2 iss[] = {is1, is2};
>
> compute_intersection_points(iss, iss+1, std::back_inserter (pts));
> }
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
- [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, zickphy, 10/07/2009
- Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, efif, 10/11/2009
- Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, zickphy, 10/11/2009
- Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, Efraim Fogel, 10/12/2009
- Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, zickphy, 10/11/2009
- Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, zickphy, 10/16/2009
- Re: [cgal-discuss] The Problem in calculate the intersection of two X_monotone_curve_2, efif, 10/11/2009
Archive powered by MHonArc 2.6.16.