

Hi, I define arrangement:
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
and I want to get a vertex position and use it for creation new circle in the arrangement but I should use a Point with rational type as circle position while the type of vertex position is
Sqrt_extension and CGAL do not convert Sqrt_extension to Rational. Now I do not know how to convert Sqrt_extension to Rational such that do not loss data.(convert exactly)


If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, e.g., segments, by the Arr_algebraic_segment_traits_2 is less efficient then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. For example ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Hi, I define arrangement:
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
and I want to get a vertex position and use it for creation new circle in the arrangement but I should use a Point with rational type as circle position while the type of vertex position is
Sqrt_extension and CGAL do not convert Sqrt_extension to Rational. Now I do not know how to convert Sqrt_extension to Rational such that do not loss data.(convert exactly)


If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, for example, segments, by the Arr_algebraic_segment_traits_2 is more timeconsuming then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. (That is, circle centers may need to have Sqrt_extension coordinates.) For example, consider a point p = (x,y) with Sqrt_extension coordinates that lies on some circle C.
You can approximating p with p' = (x', y'), such that p' also lies on C while bounding the difference between p and p'; see, e.g., CGAL::rational_rotation_approximation().
____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, e.g., segments, by the Arr_algebraic_segment_traits_2 is less efficient then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. For example ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Hi, I define arrangement:
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
and I want to get a vertex position and use it for creation new circle in the arrangement but I should use a Point with rational type as circle position while the type of vertex position is
Sqrt_extension and CGAL do not convert Sqrt_extension to Rational. Now I do not know how to convert Sqrt_extension to Rational such that do not loss data.(convert exactly)


Thanks Efi, Is it possible to define Kernel such that accept Sqrt_extension coordinates as input?
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, for example, segments, by the Arr_algebraic_segment_traits_2 is more timeconsuming then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. (That is, circle centers may need to have Sqrt_extension coordinates.) For example, consider a point p = (x,y) with Sqrt_extension coordinates that lies on some circle C.
You can approximating p with p' = (x', y'), such that p' also lies on C while bounding the difference between p and p'; see, e.g., CGAL::rational_rotation_approximation().
____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, e.g., segments, by the Arr_algebraic_segment_traits_2 is less efficient then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. For example ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Hi, I define arrangement:
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
and I want to get a vertex position and use it for creation new circle in the arrangement but I should use a Point with rational type as circle position while the type of vertex position is
Sqrt_extension and CGAL do not convert Sqrt_extension to Rational. Now I do not know how to convert Sqrt_extension to Rational such that do not loss data.(convert exactly)


Theoretically, you can define the number type of a kernel to be whatever you want, but if the number type has limitations so does the kernel defined with this number type.
Sqrt_extension is an algebraic number type (It can be used to represent algebraic numbers that are not rational) that supports certain operations in an efficient way and does not support at all other operations. A Sqrt_extension number is represented by 3 rational numbers, namely a, b, and c, and its value is (a * b * sqrt(c)).
For example. you can add 2 Sqrt_extension numbers n1 = (a1, b1, c1) and n2 = (a2, b2, c2) only if (c1 == c2) or (b1 == b2 == 0).
The Arr_circle_segment_traits_2 traits uses the fact that Sqrt_extension is an algebraic number type (cause, for example, the coordinates of an intersection point of a segment and a circle might be algebraic). However, it is limited (as explained above).
So you have two reasonable options: either use it, exploit its high performance, but stick to the rules of Arr_circle_segment_traits_2 or use something else. ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Thanks Efi, Is it possible to define Kernel such that accept Sqrt_extension coordinates as input?
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, for example, segments, by the Arr_algebraic_segment_traits_2 is more timeconsuming then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. (That is, circle centers may need to have Sqrt_extension coordinates.) For example, consider a point p = (x,y) with Sqrt_extension coordinates that lies on some circle C.
You can approximating p with p' = (x', y'), such that p' also lies on C while bounding the difference between p and p'; see, e.g., CGAL::rational_rotation_approximation().
____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, e.g., segments, by the Arr_algebraic_segment_traits_2 is less efficient then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. For example ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Hi, I define arrangement:
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
and I want to get a vertex position and use it for creation new circle in the arrangement but I should use a Point with rational type as circle position while the type of vertex position is
Sqrt_extension and CGAL do not convert Sqrt_extension to Rational. Now I do not know how to convert Sqrt_extension to Rational such that do not loss data.(convert exactly)


Thank you very much.
Theoretically, you can define the number type of a kernel to be whatever you want, but if the number type has limitations so does the kernel defined with this number type.
Sqrt_extension is an algebraic number type (It can be used to represent algebraic numbers that are not rational) that supports certain operations in an efficient way and does not support at all other operations. A Sqrt_extension number is represented by 3 rational numbers, namely a, b, and c, and its value is (a * b * sqrt(c)).
For example. you can add 2 Sqrt_extension numbers n1 = (a1, b1, c1) and n2 = (a2, b2, c2) only if (c1 == c2) or (b1 == b2 == 0).
The Arr_circle_segment_traits_2 traits uses the fact that Sqrt_extension is an algebraic number type (cause, for example, the coordinates of an intersection point of a segment and a circle might be algebraic). However, it is limited (as explained above).
So you have two reasonable options: either use it, exploit its high performance, but stick to the rules of Arr_circle_segment_traits_2 or use something else. ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Thanks Efi, Is it possible to define Kernel such that accept Sqrt_extension coordinates as input?
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, for example, segments, by the Arr_algebraic_segment_traits_2 is more timeconsuming then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. (That is, circle centers may need to have Sqrt_extension coordinates.) For example, consider a point p = (x,y) with Sqrt_extension coordinates that lies on some circle C.
You can approximating p with p' = (x', y'), such that p' also lies on C while bounding the difference between p and p'; see, e.g., CGAL::rational_rotation_approximation().
____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
If you absolutely need to use a vertex position as a circle center, you cannot use Arr_circle_segment_traits_2. In this case you need to resort to a more "powerful" traits, such as the Arr_algebraic_segment_traits_2 traits. Sqrt_extension cannot be converted to Rational without loss of data.
Naturally, managing, e.g., segments, by the Arr_algebraic_segment_traits_2 is less efficient then by the Arr_circle_segment_traits_2.
So, make sure that the above is a must. For example ____ _ ____ _ /_____/_) o /__________ __ // (____ ( ( ( (_/ (_/('_(/ _/
Hi, I define arrangement:
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
and I want to get a vertex position and use it for creation new circle in the arrangement but I should use a Point with rational type as circle position while the type of vertex position is
Sqrt_extension and CGAL do not convert Sqrt_extension to Rational. Now I do not know how to convert Sqrt_extension to Rational such that do not loss data.(convert exactly)

