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: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] compiling error of "linear_least_squares_fitting_3" under :Exact_predicates_exact_constructions_kernel
  • Date: Fri, 07 Oct 2011 08:17:46 +0200

Kai WANG wrote:
You are right Sebastien...Even if A added the "sqrt", there are still erros showing the "atan" "sin" "cos" need to be re-defined...
Does it mean I need to use two kinds of kernels in a same project if I want to ensure the calculation of intersection and linear_least_square_fitting at the same time?

Yes, have a look at the Cartesian_converter that will help you
converting objects from one kernel to another.

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Class_Cartesian_converter.html

Sebastien.


On Thu, Oct 6, 2011 at 11:49 PM, Sebastien Loriot (GeometryFactory) < <mailto:>> wrote:

You cannot do it exactly. You can only get an approximation.

Something like this should work

K::FT sqrt(K::FT v) {
return K::FT(std::sqrt(CGAL::to___double(v)));
}

No guarantee that you will not have a problem with another
function not available for this number type.

Sebastien.


Kai WANG wrote:

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)
<

<mailto:>

<mailto:

<mailto:>>>
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

<http://nabble.com/compiling-error-of-__linear-least-squares-fitting-__3-under-Exact-predicates-__exact-constructions-kernel-__tp3878596p3878596.html>

<http://cgal-discuss.949826.__n4.nabble.com/compiling-error-__of-linear-least-squares-__fitting-3-under-Exact-__predicates-exact-__constructions-kernel-__tp3878596p3878596.html

<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
<https://lists-sop.inria.fr/__wws/info/cgal-discuss>

<https://lists-sop.inria.fr/__wws/info/cgal-discuss
<https://lists-sop.inria.fr/wws/info/cgal-discuss>>




-- Kai WANG



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




--
Kai WANG





Archive powered by MHonArc 2.6.16.

Top of Page