Looking for example of 2D beziers from non-rational control points...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Looking for example of 2D beziers from non-rational control points...

stu002
Hi,

I have some data files with exported control points for 2D bezier
curves of degree 2 and 3 only.  The control points are exported as
floating point double precision values.

I believe to create CGAL Beziers I'll need to first convert these
floating point coordinates to rational approximations?

I don't need to perform intersections with the resulting curves, just
find their bounding boxes (AABB) and re-export them later with
floating point control points.

Does anyone have a small example of doing something like this in CGAL?
 I'm working my way through the examples in the
Arrangement_on_surface_2 directory which all seem to operate only in
rationals.

Thanks in advance,

Stu

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


Reply | Threaded
Open this post in threaded view
|

Re: Looking for example of 2D beziers from non-rational control points...

Efi Fogel
If you use the CGAL::Gmpq number type or the number type defined by one of the predefined kernels, you can simply initialize it from double.

   ____  _        ____             _
  /_____/_) o    /__________  __  //
 (____ (   (    (    (_/ (_/-(-'_(/
                         _/



On 10 February 2018 at 23:00, Stuart Hungerford <[hidden email]> wrote:
Hi,

I have some data files with exported control points for 2D bezier
curves of degree 2 and 3 only.  The control points are exported as
floating point double precision values.

I believe to create CGAL Beziers I'll need to first convert these
floating point coordinates to rational approximations?

I don't need to perform intersections with the resulting curves, just
find their bounding boxes (AABB) and re-export them later with
floating point control points.

Does anyone have a small example of doing something like this in CGAL?
 I'm working my way through the examples in the
Arrangement_on_surface_2 directory which all seem to operate only in
rationals.

Thanks in advance,

Stu

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



Reply | Threaded
Open this post in threaded view
|

Re: Looking for example of 2D beziers from non-rational control points...

stu002
On Wed, Feb 14, 2018 at 2:07 AM, Efi Fogel <[hidden email]> wrote:

> If you use the CGAL::Gmpq number type or the number type defined by one of
> the predefined kernels, you can simply initialize it from double.

Thanks for the hint Efi. Much appreciated.

Stu

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