Subject: CGAL users discussion list
List archive
- From: Raphael Grimm <>
- To: <>
- Subject: [cgal-discuss] Inconsistent output for Min_sphere_d
- Date: Wed, 19 Aug 2020 18:52:04 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:cM492hwjZn79P23XCy+O+j09IxM/srCxBDY+r6Qd2+8VIJqq85mqBkHD//Il1AaPAdyFrasc26GJ4+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhTexe65+IAm1oAnetMQbgpZpJ7osxBfOvnZGYfldy3lyJVKUkRb858Ow84Bm/i9Npf8v9NNOXLvjcaggQrNWEDopM2Yu5M32rhbDVheA5mEdUmoNjBVFBRXO4QzgUZfwtiv6sfd92DWfMMbrQ704RSiu4qF2QxLulSwJNSM28HvPh8JujKxVvRGvqRJxzIHbfI6VNeFzfqbBcd4AX2dNQshcWi5HD4ihb4UPFe0BPeNAoofhvVQOtRu+ChOyC+Pr1zRGh2X23aw/0+QkDArL2xYgEMgWsHTUttr6KqMSXfq6zKnSzDXDavZW1Cz+6IjJbhAtu++DUq9tccfIz0QkCgzKgEmKp4P/IzOVyvoCs3Kd7+d4Ve+ij24qpgN+rDWswsohlJXEi58bx13K9Sh0xIY7K9O7RUJmYtOpFJ9duz+GO4ZoTM0sTGNltDsnx7MJupO1cy4Hw4kkyR7Hc/GLbpaE7xb5WOqMLzp0nmxpdbyiixqo8kWs1/XwWtS73VpXtCZInMPAu3MO2hDJ6sWKRP1w9Vq71zmVzQDc8ORELFg0laXFL54hxaY9loEPvkvfByP2nV/5jK6SdkUj5+io9/3rYrbnpp+ALoN4lhzyPr41msOjHes0KAsOX2mH+eimyrLs4FD5TK1Ljv0wjKbZrIjXKdkFqqO9GQNZz4gu5wyhAzqozdgUh3oKIE9ddBKClYfpOlXOIP7iDfe4hlShiC1ryOrePr3hGJrCMHzDnK3ufbZn6k5czQ8zwMtc55JVFrENOuz8VVLstNDAFB82LxS0w/r7CNV6zo4RRW2PDbWdMK/LrFCI5/kvLPWRZI8OozbwMOMl5v7rjX8hg1ARZ6ip3Z0NaHC5BPtqOUuZYWC/yusGRDMBsQM6CeDrk1afSiV7ZnCoXqt66CttW6y8CoKWfIm1gLWM2G+UBJxTYygSEFmUEX7lc8OLQfYJbQqRI9MnnzAZA+vyA7Q93A2j4Vepg4FsKfDZr3VB6cDTkeNt7uiWrikcsCRuBpXP0GCRCWx4gzFQHmJk7OVEuUV4j2y7/+14jvhfToYB/PhCFwIzNJrb0vA/CNHuH1qYOMyCQxClQ8ngDD0sHIpoko0+Jn1lEtDntSjtmi+jArsbjbuOVc43876a0nTsdZ9w
Hi,
i was playing around with Min_sphere_d and encountered some behavior i do not understand (see attached files).
In both cases my code creates a Min_sphere_d using Min_sphere_annulus_d_traits_3 and Epick and then it inserts three points and prints the radius.
In the first case i used doubles to initialize the Point_3 and the output is correct.
In the second case i used floats to initialize the Point_3 and the output is nan.
The only difference is the type of the values used to initialize the Point_3.
This means the error has to be caused by the differences in accuracy, but this should not really create a difference.
Has anyone any idea why this happens and how i can prevent this problem?
Since the data i am using is represented as floats, I can't really switch everything to double.
I appreciate any help.
Best regards,
Raphael
PS.: I am on master (54f2a119f9598f884f98df9ee1fa63aa07451c4c).
#include <iostream> #include <cstdlib> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Min_sphere_annulus_d_traits_3.h> #include <CGAL/Min_sphere_d.h> typedef CGAL::Epick K; typedef CGAL::Min_sphere_annulus_d_traits_3<K> Traits; typedef CGAL::Min_sphere_d<Traits> Min_sphere; typedef K::Point_3 Point; int main () { std::cout << "\ndirect insert double (point set 1)\n"; { Min_sphere ms; ms.insert(Point{132.973, 8.457, -34.103}); ms.insert(Point{147.746, -2.665, -36.310}); ms.insert(Point{132.973, 8.457, -34.103}); std::cout << "r^2 " << ms.squared_radius() << " c " << ms.center() << "\n"; } std::cout << "\ndirect insert float (point set 1)\n"; { Min_sphere ms; ms.insert(Point(132.973f, 8.457f, -34.103f)); ms.insert(Point(147.746f, -2.665f, -36.310f)); ms.insert(Point(132.973f, 8.457f, -34.103f)); std::cout << "r^2 " << ms.squared_radius() << " c " << ms.center() << "\n"; } std::cout << "\nindirect insert double (point set 1)\n"; { Min_sphere ms; Point p1(132.973, 8.457, -34.103); Point p2(147.746, -2.665, -36.310); Point p3(132.973, 8.457, -34.103); std::cout << "p1 " << p1 << " p2 " << p2 << " p3 " << p3 << '\n'; ms.insert(p1); ms.insert(p2); ms.insert(p3); std::cout << "r^2 " << ms.squared_radius() << " c " << ms.center() << "\n"; } std::cout << "\nindirect insert float (point set 1)\n"; { Min_sphere ms; Point p1(132.973f, 8.457f, -34.103f); Point p2(147.746f, -2.665f, -36.310f); Point p3(132.973f, 8.457f, -34.103f); std::cout << "p1 " << p1 << " p2 " << p2 << " p3 " << p3 << '\n'; ms.insert(p1); ms.insert(p2); ms.insert(p3); std::cout << "r^2 " << ms.squared_radius() << " c " << ms.center() << "\n"; } std::cout << "\ndirect insert float (point set 2)\n"; { Min_sphere ms; ms.insert(Point(132.f, 8.f, -34.f)); ms.insert(Point(147.f, -2.f, -36.f)); ms.insert(Point(132.f, 8.f, -34.f)); std::cout << "r^2 " << ms.squared_radius() << " c " << ms.center() << "\n"; } return 0; }direct insert double (point set 1)
r^2 86.7028 c 140.36 2.896 -35.2065
direct insert float (point set 1)
r^2 -nan c -nan -nan -nan
indirect insert double (point set 1)
p1 132.973 8.457 -34.103 p2 147.746 -2.665 -36.31 p3 132.973 8.457 -34.103
r^2 86.7028 c 140.36 2.896 -35.2065
indirect insert float (point set 1)
p1 132.973 8.457 -34.103 p2 147.746 -2.665 -36.31 p3 132.973 8.457 -34.103
r^2 -nan c -nan -nan -nan
direct insert float (point set 2)
r^2 82.25 c 139.5 3 -35
- [cgal-discuss] Inconsistent output for Min_sphere_d, Raphael Grimm, 08/19/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Hoffmann Michael, 08/19/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Raphael Grimm, 08/20/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Hoffmann Michael, 08/20/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Andreas Fabri, 08/20/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Hoffmann Michael, 08/20/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Raphael Grimm, 08/20/2020
- Re: [cgal-discuss] Inconsistent output for Min_sphere_d, Hoffmann Michael, 08/19/2020
Archive powered by MHonArc 2.6.19+.