Subject: CGAL users discussion list
List archive
- From: Morteza Manavi <>
- To:
- Subject: Re: [cgal-discuss] Convert arrangement output point
- Date: Mon, 17 Sep 2018 10:38:49 +0430
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:Gi/IfB17kw/8KczCsmDT+DRfVm0co7zxezQtwd8Zse0QK/ad9pjvdHbS+e9qxAeQG9mDtLQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPYQhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLnhykHODw5/m/ZicJ+kbxVrw66qhNl34LZepuYOOZicq7fe94RWGpPXtxWVyxEGo6yaIwPD/AdPelGrojyvUYFoxykCgmqHuzv1D5IjWLx0K0/1OQhCx3G0xIhHt0UrHjYsMj5OLoPXe2uw6nIyC/Mb/JS2Tvn9IfIdRUhrOiKULltf8TRzkwvGBnEjlWWsYHqIzyV2f4Js2SB6OpgT+2vhmg6oA9yujii3tkghpXNi44PyV3J9T91zJgpKdC7UkJ3fNqpHZVWuiqHLYV5WNkiTHttuCsiyr0Jp5q7fC8SxZQi3RHfaviHf5GM4hLhSeqdODl4iG9hdb+xnRqy/k+gyurzVsmwzllGtDZKkt7JtnwV1hzT7NaISudl80u/xTqC0xrf5+JELEwui6bXN50szqQtmpcXv0nPBir2l1/3jK+SeEUk4O+o6+H/b7XjoZ+cLZN0hR//M6s0hsCzHfk0PhUTU2WA9uS80afs/Uz9QLlQkvI2lazZvIjAJcsHvq65HxNV0oE75hmjADepytAYkWAaI1JEYxKIk5XpO0rVIP3jFve+g1GskC9xyPzcP73hBI/NLnnZn7v7c7Z98R0U9A1mxt9W49dYC6oKPenock73rt3RSBEjYCKuxOOyLdJnyo4MUCqqC6mQLqKa5VqP/P4iMeDUPNZM4R7yLvEk47jlinpvygxVRrWgwZZCMCPwJf9hOUjMOSO90OdEKn8Du08FdMKvjVSDVTBJYHPrBvAz4zg6DMStCoKRH9nx0ozE5z+yG9htXk4DEkqFSC66eICNWvNKYyWXcJc4z240EIO5Qopk7imA8Q/3z709cLjR8ywc8JbhjZ17vryI0x418jNwAoKW1GTfF2w=
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 time-consuming 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)
- [cgal-discuss] Convert arrangement output point, Morteza Manavi, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Efi Fogel, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Efi Fogel, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Morteza Manavi, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Efi Fogel, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Morteza Manavi, 09/17/2018
- Re: [cgal-discuss] Convert arrangement output point, Efi Fogel, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Morteza Manavi, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Efi Fogel, 09/16/2018
- Re: [cgal-discuss] Convert arrangement output point, Efi Fogel, 09/16/2018
Archive powered by MHonArc 2.6.18.