Search code examples
cgal

Create exact type d-dimension points, segments, etc... in using CGAL


Here is how I create 2D points with various precisions by using CGAL

#include <CGAL/Cartesian.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>

typedef CGAL::Cartesian<float> Kernel_float; 
typedef Exact_predicates_exact_constructions_kernel Kernel_exact; 

typedef Kernel_float::Point_2 Point_2_float; 
typedef Kernel_exact::Point_2 Point_2_exact; 

Here is how I create d-dimension 32-bit floating-point type point

#includee <CGAL/Cartesian_d.h>

typedef CGAL::Cartesian_d<float> Kernel_d_float; 

typedef Kernel_d_float::Point_d Point_d_float; 

However, I cannot create exact type of Point_d... Since there is no header file like

CGAL/Exact_predicates_exact_constructions_kernel_d.h

Doesn't CGAL support exact type of d-dimension kernels?


Solution

  • To get an exact dD-kernel, use a exact number type with CGAL::Cartesian_d, for example:

    #include <CGAL/Cartesian_d.h>
    #include <CGAL/Gmpq.h>
    
    typedef CGAL::Cartesian_d<CGAL::Gmpq> Exact_kernel_d;