Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] How to convert form Circular_arc_point_2 to Point_2

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] How to convert form Circular_arc_point_2 to Point_2


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] How to convert form Circular_arc_point_2 to Point_2
  • Date: Mon, 17 Dec 2012 11:55:57 +0100
  • Organization: GeometryFactory

On 12/17/2012 03:22 AM, Wang Hetao wrote:
I encountered a problem when converting form Circular_arc_point_2 type to
Point_2 in my program. What I consistently do in the past about this kind
conversion is first converting the X and Y coordinates to double with
CGAL::to_double(), then constructing a regular Point_2 with converted
figures. This method is complex and imprecise, I wander whether there is a
simple and more accurate method.
The coordinates of a Circular_arc_point_2 are algebraic numbers of
degree 2 (AN2) so there are no exact conversion to a Point_2 from any
Kernel, but a one instantiated with a FieldWithSqrt [1] (Core::Expr or
LEDA::Real).

If you want to rely on a double number type at the end you need
to_double or a tricky conversion based on the internal representation
of AN2 (Sqrt_extension [2])




Another problem that confused me for a long time is CGAL lib borrows many
data types form other libs. e.g., LEDA, GNU::GMP, CORE, and built-in number
types of course. I think this may makes CGAL very hard to use.


What do you suggest? Rewrite our own number types? These libraries are
made by number types expert, and it would be a really bad idea to come
up with our own number types.


Sebastien.

[1]http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Algebraic_foundations_ref/Concept_FieldWithSqrt.html
[2] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/NumberTypeSupport_ref/Class_Sqrt_extension.html

many thanks for you reply!



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/How-to-convert-form-Circular-arc-point-2-to-Point-2-tp4656403.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page