Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: About Bezier curves in Arrangement

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: About Bezier curves in Arrangement


Chronological Thread 
  • From: stzpz <>
  • To:
  • Subject: [cgal-discuss] Re: About Bezier curves in Arrangement
  • Date: Thu, 3 Feb 2011 10:18:42 -0800 (PST)

Thanks so much for the patch. It looks OK. But I found another problem: When I use locate() to determine the location of the point, assertion will appear if the point lies in one of the lines in arrangement (but not in the intersection point), just like the code below:

----------------------------- CODE BEGIN -----------------------------
#include <CGAL/basic.h>
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_Bezier_curve_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_curve_data_traits_2.h>
#include <CGAL/Arr_walk_along_line_point_location.h>
#include <CGAL/to_rational.h>

typedef CGAL::CORE_algebraic_number_traits              Nt_traits;
typedef Nt_traits::Rational                             NT;
typedef Nt_traits::Rational                             Rational;
typedef Nt_traits::Algebraic                            Algebraic;
typedef CGAL::Cartesian<Rational>                       Rat_kernel;
typedef CGAL::Cartesian<Algebraic>                      Alg_kernel;
typedef Rat_kernel::Point_2                             Rat_point_2;
typedef CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits> Traits_org_2;
typedef Traits_org_2::Curve_2 Bezier_curve_2;

typedef unsigned int CurveNumber;
typedef CGAL::Arr_curve_data_traits_2<Traits_org_2, CurveNumber> Traits_2;

typedef Traits_2::Curve_2                               Bezier_curve_num_2;
typedef Traits_2::X_monotone_curve_2                    X_monotone_curve_2;
typedef Traits_2::Point_2 Point_2;
typedef CGAL::Arrangement_2<Traits_2>                   Arrangement_2;
typedef CGAL::Arr_walk_along_line_point_location<Arrangement_2>   Naive_pl;

#define TORAT(x) (CGAL::to_rational<Rational>((x)))

int main (int argc, char *argv[])
{
  const char   *filename = (argc > 1) ? argv[1] : "test4.dat";
  std::ifstream   in_file (filename);
  int               n_curves;
  std::list<Bezier_curve_num_2>  curves;
  Bezier_curve_2             B;
  int               k; 
  in_file >> n_curves;
  for (k = 0; k < n_curves; k++) {
    in_file >> B;
    Bezier_curve_num_2 bb(B, k);
    curves.push_back (bb);
  }
  
  Arrangement_2                     arr;
  insert (arr, curves.begin(), curves.end());
  
  // Points like (10, 0), (40, 30), (30, 10) are lie in the lines  
  Point_2 p(TORAT(40), TORAT(30));

  // Here comes the assertion
  CGAL::Object obj = pl.locate(p);

  return 0;
}
----------------------------- CODE END -----------------------------

Here is the test4.dat:

---------------------------- DATA BEGIN ------------------------------
3
2 0 0 100 0
2 30 -20 30 80
2 100 -15 -20 75
---------------------------- DATA END ------------------------------

Thanks again for your kindly help!

Sincerely yours,

Stzpz



2011/2/1 Sebastien Loriot (GeometryFactory) [via cgal-discuss] <[hidden email]>
stzpz wrote:
> Thanks very much for your reply!
>
Please found attached patch files that should solve your problem.
Can you try them and tell us whether it works now?


> For the first question, is that better to let the returning
> supporting_curve() contains the correct auxiliary data? Because the
> returning type of supporting_curve() is Arr_curve_data_traits_2.
The return type of
Arr_curve_data_traits_2<Traits_org_2,CurveNumber>::X_monotone_curve_2::supporting_curve()
is Traits_org_2::Curve_2 because it inherits from
Traits_org_2::X_monotone_curve_2

>
> In addition, I have one more question. Because I want to calculate the
> new control points of each sub bezier curve (X_monotone_curve_2), I use
> parameter_range() with de_Casteljau_2() to do that. But it seems that
> the returned values of parameter_range() is not so accurate for some
> case and hence influences the result of de_Casteljau_2(). For example,
> in the following code,
>
As documented  parameter_range() returns "the approximate parameter
range defining the subcurve b."


S.
[snip]



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


patch.tgz (17K) Download Attachment



If you reply to this email, your message will be added to the discussion below:
http://cgal-discuss.949826.n4.nabble.com/About-Bezier-curves-in-Arrangement-tp3238384p3250909.html
To unsubscribe from About Bezier curves in Arrangement, click here.



View this message in context: Re: About Bezier curves in Arrangement
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page