Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] compiling error of "linear_least_squares_fitting_3" under :Exact_predicates_exact_constructions_kernel

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] compiling error of "linear_least_squares_fitting_3" under :Exact_predicates_exact_constructions_kernel


Chronological Thread 
  • From: Kai WANG <>
  • To:
  • Subject: Re: [cgal-discuss] compiling error of "linear_least_squares_fitting_3" under :Exact_predicates_exact_constructions_kernel
  • Date: Thu, 6 Oct 2011 23:44:58 +0800

I'm sorry that I still don't quite understand how to modify it. Could you please give a detailed explanation on the way to add a "sqrt" function please? For example, given the following simple program which has complile error, where should I add the "sqrt" function please?
Thanks very much for ur help!


typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Line_3            Line;
typedef K::Plane_3           Plane;
typedef K::Point_3           Point;
typedef K::Triangle_3        Triangle;

int main(void)
{
  std::list<Triangle> triangles;
  Point a(1.0,2.0,3.0);
  Point b(4.0,0.0,6.0);
  Point c(7.0,8.0,9.0);
  Point d(8.0,7.0,6.0);
  Point e(5.0,3.0,4.0);
  triangles.push_back(Triangle(a,b,c));
  triangles.push_back(Triangle(a,b,d));
  triangles.push_back(Triangle(d,e,c));

  Line line;
  Plane plane;

  // fit plane to whole triangles
  linear_least_squares_fitting_3(triangles.begin(),triangles.end(),plane,CGAL::Dimension_tag<2>());
 
  // fit line to triangle vertices
  linear_least_squares_fitting_3(triangles.begin(),triangles.end(),line, CGAL::Dimension_tag<0>());
 
  return 0;
}




On Thu, Oct 6, 2011 at 11:31 PM, Sebastien Loriot (GeometryFactory) <> wrote:
the PCA package make use of the square root function, so the underlying
number type in the kernel you are using should have a sqrt function
available.

Sebastien.



kyewong wrote:
Hi,
When I'm using the linear_least_squares_fitting_3 and
CGAL::Exact_predicates_exact_constructions_kernel as kernel, there will be a
compile error as follows.
Could anyone tell me how to modify it if I want to use both of them at the
same time please? Thanks very much!


1>F:\Program Files\CGAL-3.8\include\CGAL/PCA_util.h(132) : error C2665:
'sqrt' : none of the 3 overloads could convert all the argument types
1>        F:\Program Files\Microsoft Visual Studio
9.0\VC\include\math.h(581): could be 'long double sqrt(long double)'
1>        F:\Program Files\Microsoft Visual Studio
9.0\VC\include\math.h(533): or       'float sqrt(float)'
1>        F:\Program Files\Microsoft Visual Studio
9.0\VC\include\math.h(128): or       'double sqrt(double)'
1>        while trying to match the argument list
'(CGAL::Lazy_exact_nt<ET_>)'
1>        with
1>        [
1>            ET_=CGAL::Gmpq
1>        ]
1>        F:\Program
Files\CGAL-3.8\include\CGAL/linear_least_squares_fitting_triangles_3.h(57) :
see reference to function template instantiation 'void
CGAL::internal::assemble_covariance_matrix_3&lt;InputIterator,K&gt;(InputIterator,InputIterator,CGAL::Lazy_exact_nt<ET_>
[],const CGAL::Point_3<R_> &,const K &,const CGAL::Triangle_3<R_> *,const
CGAL::Dimension_tag<dim> &)' being compiled
1>        with
1>        [
1>            InputIterator=std::list<Triangle>::_Iterator<true>,
1>            K=CGAL::Epeck,
1>            ET_=CGAL::Gmpq,
1>            R_=CGAL::Epeck,
1>            dim=2
1>        ]
1>        F:\Program
Files\CGAL-3.8\include\CGAL/linear_least_squares_fitting_3.h(58) : see
reference to function template instantiation 'CGAL::Lazy_exact_nt<ET_>
CGAL::internal::linear_least_squares_fitting_3&lt;InputIterator,Kernel&gt;(InputIterator,InputIterator,CGAL::Plane_3<R_>
&,CGAL::Point_3<R_> &,const CGAL::Triangle_3<R_> *,const K &,const
CGAL::Dimension_tag<dim> &)' being compiled
1>        with
1>        [
1>            ET_=CGAL::Gmpq,
1>            InputIterator=std::list<Triangle>::_Iterator<true>,
1>            Kernel=CGAL::Epeck,
1>            R_=CGAL::Epeck,
1>            K=CGAL::Epeck,
1>            dim=2
1>        ]
1>        F:\Program
Files\CGAL-3.8\include\CGAL/linear_least_squares_fitting_3.h(76) : see
reference to function template instantiation 'CGAL::Lazy_exact_nt<ET_>
CGAL::linear_least_squares_fitting_3&lt;InputIterator,Object,CGAL::Epeck,Tag&gt;(InputIterator,InputIterator,Object
&,CGAL::Point_3<R_> &,const Tag &,const Kernel &)' being compiled
1>        with
1>        [
1>            ET_=CGAL::Gmpq,
1>            InputIterator=std::list<Triangle>::_Iterator<true>,
1>            Object=Plane,
1>            Tag=CGAL::Dimension_tag<2>,
1>            R_=CGAL::Epeck,
1>            Kernel=CGAL::Epeck
1>        ]
1>        F:\Program
Files\CGAL-3.8\include\CGAL/linear_least_squares_fitting_3.h(93) : see
reference to function template instantiation 'CGAL::Lazy_exact_nt<ET_>
CGAL::linear_least_squares_fitting_3&lt;InputIterator,Object,CGAL::Point_3&lt;R_&gt;,Tag>(InputIterator,InputIterator,Object
&,Point &,const Tag &)' being compiled
1>        with
1>        [
1>            ET_=CGAL::Gmpq,
1>            InputIterator=std::list<Triangle>::_Iterator<true>,
1>            Object=Plane,
1>            R_=CGAL::Epeck,
1>            Tag=CGAL::Dimension_tag<2>,
1>            Point=CGAL::Point_3<CGAL::Epeck>
1>        ]
1>        .\linear_least_squares_fitting_triangles_3.cpp(33) : see reference
to function template instantiation 'CGAL::Lazy_exact_nt<ET_>
CGAL::linear_least_squares_fitting_3&lt;std::list&lt;_Ty&gt;::_Iterator<_Secure_validation>,Plane,CGAL::Dimension_tag<dim>>(InputIterator,InputIterator,Object
&,const Tag &)' being compiled
1>        with
1>        [
1>            ET_=CGAL::Gmpq,
1>            _Ty=Triangle,
1>            _Secure_validation=true,
1>            dim=2,
1>            InputIterator=std::list<Triangle>::_Iterator<true>,
1>            Object=Plane,
1>            Tag=CGAL::Dimension_tag<2>
1>        ]

--
View this message in context: http://cgal-discuss.949826.n4.nabble.com/compiling-error-of-linear-least-squares-fitting-3-under-Exact-predicates-exact-constructions-kernel-tp3878596p3878596.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss




--
Kai WANG




Archive powered by MHonArc 2.6.16.

Top of Page