精确to_double

时间:2017-04-08 20:23:30

标签: cgal

在这个CGAl程序中,我使用Exact_predicates_exact_constructions内核,因为我想要计算的准确性。我有一个Point_3向量std::vector< Point_3> points;,我想复制数组中的x坐标。通过如下操作,我会失去精确度吗?

double A [points.size()];
 for (int i = 0;
  i != points.size();
 ++i)
 {
A[i] = CGAL::to_double(points[i].x());                   
}  

在商上使用CGAL :: to_double时,我是否也会失去精确度?是否可以按如下方式创建平面,而无需进行转换? 编辑:

 // choose exact integral type
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz ET;
#else
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float ET;
#endif

typedef CGAL::Exact_predicates_exact_constructions_kernel  K;
typedef K::Plane_3                                         Plane_3;
typedef CGAL::Quadratic_program_solution<ET>               Solution;
typedef CGAL::Quotient<ET>                                 Quotient;
//
// lp is a linear program with double matrices A,b,c
Solution s = CGAL::solve_linear_program(lp, ET());
Solution::Variable_value_iterator it = s.variable_values_begin();
 const Quotient a=*it;
 const Quotient b=*(++it);
 const Quotient c=*(++it);

Plane_3 new_plane=Plane_3(a,b,-1,c);

编译时,我收到一条错误消息,如下所示: 错误:没有用于调用'CGAL :: Plane_3&lt;的匹配函数CGAL :: Epeck&gt; :: Plane_3(const Quotient&amp;,const Quotient&amp;,int,const Quotient&amp;)'

0 个答案:

没有答案