mirror of https://github.com/CGAL/cgal
change argument type of {translate|scale}{homogeneous} back to Innermost_leading_coefficient
This commit is contained in:
parent
1334e4d87b
commit
a69bf8339d
|
|
@ -3,8 +3,8 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL:$
|
||||
// $Id:$
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Hemmer <hemmer@mpi-inf.mpg.de>
|
||||
|
|
@ -228,8 +228,8 @@ CGAL_BINARY_POLY_FUNCTION_INDEX(Translate,translate);
|
|||
template <typename Polynomial_d> inline
|
||||
typename Polynomial_traits_d<Polynomial_d>::Translate_homogeneous::result_type
|
||||
translate_homogeneous(const Polynomial_d& f,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& den){
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den){
|
||||
|
||||
typedef Polynomial_traits_d<Polynomial_d> PT;
|
||||
return typename PT::Translate_homogeneous()(f,num,den);
|
||||
|
|
@ -237,8 +237,8 @@ translate_homogeneous(const Polynomial_d& f,
|
|||
template <typename Polynomial_d> inline
|
||||
typename Polynomial_traits_d<Polynomial_d>::Translate_homogeneous::result_type
|
||||
translate_homogeneous(const Polynomial_d& f,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& den,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den,
|
||||
int index ){
|
||||
typedef Polynomial_traits_d<Polynomial_d> PT;
|
||||
return typename PT::Translate_homogeneous()(f,num,den,index);
|
||||
|
|
@ -249,8 +249,8 @@ CGAL_BINARY_POLY_FUNCTION_INDEX(Scale,scale);
|
|||
template <typename Polynomial_d> inline
|
||||
typename Polynomial_traits_d<Polynomial_d>::Scale_homogeneous::result_type
|
||||
scale_homogeneous(const Polynomial_d& f,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& den){
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den){
|
||||
|
||||
typedef Polynomial_traits_d<Polynomial_d> PT;
|
||||
return typename PT::Scale_homogeneous()(f,num,den);
|
||||
|
|
@ -258,8 +258,8 @@ scale_homogeneous(const Polynomial_d& f,
|
|||
template <typename Polynomial_d> inline
|
||||
typename Polynomial_traits_d<Polynomial_d>::Scale_homogeneous::result_type
|
||||
scale_homogeneous(const Polynomial_d& f,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& den,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num,
|
||||
const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den,
|
||||
int index ){
|
||||
typedef Polynomial_traits_d<Polynomial_d> PT;
|
||||
return typename PT::Scale_homogeneous()(f,num,den,index);
|
||||
|
|
|
|||
|
|
@ -562,8 +562,8 @@ void test_translate(const Polynomial_traits_d&){
|
|||
|
||||
for(int i = 0 ; i < 5 ; i++){
|
||||
Polynomial_d p = generate_sparse_random_polynomial<Polynomial_d>();
|
||||
assert(evaluate(translate(p,Coeff(5)),Coeff(3))
|
||||
== evaluate(p,Coeff(8)));
|
||||
assert(evaluate(translate(p,ICoeff(5)),ICoeff(3))
|
||||
== evaluate(p,ICoeff(8)));
|
||||
}
|
||||
std::cerr << " ok "<< std::endl;
|
||||
}
|
||||
|
|
@ -583,17 +583,17 @@ void test_translate_homongenous(const Polynomial_traits_d&){
|
|||
for(int i = 0 ; i < 5 ; i++){
|
||||
Polynomial_d p,q1,q2;
|
||||
p = generate_sparse_random_polynomial<Polynomial_d>();
|
||||
q1 = transh(transh(p,Coeff(5),Coeff(3)),Coeff(3),Coeff(2)) ;
|
||||
q2 = transh(p,Coeff(19),Coeff(6)) ;
|
||||
q1 = transh(transh(p,ICoeff(5),ICoeff(3)),ICoeff(3),ICoeff(2)) ;
|
||||
q2 = transh(p,ICoeff(19),ICoeff(6)) ;
|
||||
assert(canonicalize(q1) != canonicalize(p)) ;
|
||||
assert(canonicalize(q2) != canonicalize(p)) ;
|
||||
assert(canonicalize(q1) == canonicalize(q2));
|
||||
|
||||
assert(
|
||||
evh(p,Coeff(19),Coeff(6)) == evh(q2,Coeff(0),Coeff(1)));
|
||||
evh(p,ICoeff(19),ICoeff(6)) == evh(q2,ICoeff(0),ICoeff(1)));
|
||||
|
||||
q1 = transh(transh(p,Coeff(5),Coeff(3),0),Coeff(3),Coeff(2),0) ;
|
||||
q2 = transh(p,Coeff(19),Coeff(6),0) ;
|
||||
q1 = transh(transh(p,ICoeff(5),ICoeff(3),0),ICoeff(3),ICoeff(2),0) ;
|
||||
q2 = transh(p,ICoeff(19),ICoeff(6),0) ;
|
||||
|
||||
assert(canonicalize(q1) != canonicalize(p)) ;
|
||||
assert(canonicalize(q2) != canonicalize(p)) ;
|
||||
|
|
@ -613,7 +613,7 @@ void test_scale(const Polynomial_traits_d&) {
|
|||
Polynomial_d p(Coeff(1), Coeff(2), Coeff(3));
|
||||
|
||||
assert(
|
||||
scale(p, Coeff(2)) == Polynomial_d(Coeff(1), Coeff(4), Coeff(12)));
|
||||
scale(p, ICoeff(2)) == Polynomial_d(Coeff(1), Coeff(4), Coeff(12)));
|
||||
|
||||
std::cerr << " ok" << std::endl;
|
||||
}
|
||||
|
|
@ -631,13 +631,13 @@ void test_scale_homogeneous(const Polynomial_traits_d&){
|
|||
for(int i = 0 ; i < 5 ; i++){
|
||||
Polynomial_d p,q1,q2;
|
||||
p = generate_sparse_random_polynomial<Polynomial_d>();
|
||||
q1 = scaleh(scaleh(p,Coeff(5),Coeff(3)),Coeff(3),Coeff(2)) ;
|
||||
q2 = scaleh(p,Coeff(15),Coeff(6)) ;
|
||||
q1 = scaleh(scaleh(p,ICoeff(5),ICoeff(3)),ICoeff(3),ICoeff(2)) ;
|
||||
q2 = scaleh(p,ICoeff(15),ICoeff(6)) ;
|
||||
assert(canonicalize(q1) != canonicalize(p)) ;
|
||||
assert(canonicalize(q2) != canonicalize(p)) ;
|
||||
assert(canonicalize(q1) == canonicalize(q2));
|
||||
q1 = scaleh(scaleh(p,Coeff(5),Coeff(3),0),Coeff(3),Coeff(2),0) ;
|
||||
q2 = scaleh(p,Coeff(15),Coeff(6),0) ;
|
||||
q1 = scaleh(scaleh(p,ICoeff(5),ICoeff(3),0),ICoeff(3),ICoeff(2),0) ;
|
||||
q2 = scaleh(p,ICoeff(15),ICoeff(6),0) ;
|
||||
|
||||
assert(canonicalize(q1) != canonicalize(p)) ;
|
||||
assert(canonicalize(q2) != canonicalize(p)) ;
|
||||
|
|
|
|||
|
|
@ -161,28 +161,28 @@ void test_polynomial_utils(){
|
|||
assert(CGAL::invert(p,2) == -5*x*x*x*y*z*z+7*y);
|
||||
assert(CGAL::invert(p) == -5*x*x*x*y*z*z+7*y);
|
||||
//Translate
|
||||
assert(CGAL::translate(x*y*z,COEFF(2),0) == (x+2)*y*z);
|
||||
assert(CGAL::translate(x*y*z,COEFF(2),1) == (y+2)*x*z);
|
||||
assert(CGAL::translate(x*y*z,COEFF(2),2) == (z+2)*x*y);
|
||||
assert(CGAL::translate(x*y*z,COEFF(2)) == (z+2)*x*y);
|
||||
assert(CGAL::translate(x*y*z,ICOEFF(2),0) == (x+2)*y*z);
|
||||
assert(CGAL::translate(x*y*z,ICOEFF(2),1) == (y+2)*x*z);
|
||||
assert(CGAL::translate(x*y*z,ICOEFF(2),2) == (z+2)*x*y);
|
||||
assert(CGAL::translate(x*y*z,ICOEFF(2)) == (z+2)*x*y);
|
||||
//TranslateHomogeneous
|
||||
assert(CGAL::translate_homogeneous(x*y*z,COEFF(2),COEFF(3),0) == (3*x+2)*y*z);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,COEFF(2),COEFF(3),1) == (3*y+2)*x*z);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,COEFF(2),COEFF(3),2) == (3*z+2)*x*y);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,COEFF(2),COEFF(3)) == (3*z+2)*x*y);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,ICOEFF(2),ICOEFF(3),0)==(3*x+2)*y*z);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,ICOEFF(2),ICOEFF(3),1)==(3*y+2)*x*z);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,ICOEFF(2),ICOEFF(3),2)==(3*z+2)*x*y);
|
||||
assert(CGAL::translate_homogeneous(x*y*z,ICOEFF(2),ICOEFF(3)) ==(3*z+2)*x*y);
|
||||
//Scale
|
||||
assert(CGAL::scale(x*x+y*y+z*z,COEFF(2),0) == 4*x*x+y*y+z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,COEFF(2),1) == x*x+4*y*y+z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,COEFF(2),2) == x*x+y*y+4*z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,COEFF(2)) == x*x+y*y+4*z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,ICOEFF(2),0) == 4*x*x+y*y+z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,ICOEFF(2),1) == x*x+4*y*y+z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,ICOEFF(2),2) == x*x+y*y+4*z*z);
|
||||
assert(CGAL::scale(x*x+y*y+z*z,ICOEFF(2)) == x*x+y*y+4*z*z);
|
||||
//ScaleHomogeneous
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,COEFF(2),COEFF(3),0)
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,ICOEFF(2),ICOEFF(3),0)
|
||||
== 4*x*x+9*y*y+9*z*z);
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,COEFF(2),COEFF(3),1)
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,ICOEFF(2),ICOEFF(3),1)
|
||||
== 9*x*x+4*y*y+9*z*z);
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,COEFF(2),COEFF(3),2)
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,ICOEFF(2),ICOEFF(3),2)
|
||||
== 9*x*x+9*y*y+4*z*z);
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,COEFF(2),COEFF(3))
|
||||
assert(CGAL::scale_homogeneous(x*x+y*y+z*z,ICOEFF(2),ICOEFF(3))
|
||||
== 9*x*x+9*y*y+4*z*z);
|
||||
//Resultant
|
||||
assert(CGAL::is_zero(CGAL::resultant(p,p)));
|
||||
|
|
|
|||
Loading…
Reference in New Issue