mirror of https://github.com/CGAL/cgal
remove NOT CGAL_HEADER_ONLY
This commit is contained in:
parent
fa2e8ec0a4
commit
39f97ca56b
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_CONVERTER_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_CONVERTER_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
#include <CGAL/NT_converter.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// TODO :
|
||||
// - FT converter ?
|
||||
|
||||
template < class Al_K1, class Al_K2,
|
||||
class RT_converter = NT_converter<typename Al_K1::RT,
|
||||
typename Al_K2::RT>,
|
||||
class Root_of_converter = NT_converter<typename Al_K1::Root_of_2,
|
||||
typename Al_K2::Root_of_2 > >
|
||||
class Algebraic_kernel_converter {
|
||||
public:
|
||||
|
||||
typedef typename Al_K1::RT RT_1;
|
||||
typedef typename Al_K2::RT RT_2;
|
||||
typedef RT_converter RT_type_converter;
|
||||
typedef Root_of_converter Root_of_type_converter;
|
||||
|
||||
typename Al_K2::Polynomial_1_2 operator () (const typename Al_K1::Polynomial_1_2 &p) const
|
||||
{
|
||||
return typename Al_K2::Polynomial_1_2(RT_converter()(p.a()),
|
||||
RT_converter()(p.b()),
|
||||
RT_converter()(p.c()));
|
||||
}
|
||||
|
||||
typename Al_K2::Polynomial_for_circles_2_2 operator ()
|
||||
(const typename Al_K1::Polynomial_for_circles_2_2 &p) const
|
||||
{
|
||||
return typename Al_K2::Polynomial_for_circles_2_2(RT_converter()(p.a()),
|
||||
RT_converter()(p.b()),
|
||||
RT_converter()(p.r_sq()));
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_CONVERTER_H
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTION_OBJECTS_ON_ROOTS_AND_POLYNOMIALS_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTION_OBJECTS_ON_ROOTS_AND_POLYNOMIALS_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomials_2_2.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomial_1_2_and_2_2.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles/internal_functions_comparison_root_for_circles_2_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace AlgebraicFunctors {
|
||||
|
||||
template < class AK >
|
||||
class Solve
|
||||
{
|
||||
typedef typename AK::Polynomial_for_circles_2_2 Equation_Circle;
|
||||
typedef typename AK::Polynomial_1_2 Equation_Line;
|
||||
|
||||
public:
|
||||
typedef void result_type;
|
||||
|
||||
template < class OutputIterator >
|
||||
OutputIterator
|
||||
operator()(const Equation_Circle & e1,
|
||||
const Equation_Circle & e2,
|
||||
OutputIterator res) const
|
||||
{ return AlgebraicFunctors::solve<AK> ( e1, e2, res); }
|
||||
|
||||
template < class OutputIterator >
|
||||
OutputIterator
|
||||
operator()(const Equation_Line & e1,
|
||||
const Equation_Circle & e2,
|
||||
OutputIterator res) const
|
||||
{ return AlgebraicFunctors::solve<AK> ( e1, e2, res); }
|
||||
|
||||
|
||||
template < class OutputIterator >
|
||||
OutputIterator
|
||||
operator()(const Equation_Circle & e1,
|
||||
const Equation_Line & e2,
|
||||
OutputIterator res) const
|
||||
{ return AlgebraicFunctors::solve<AK> ( e1, e2, res); }
|
||||
|
||||
template < class OutputIterator >
|
||||
OutputIterator
|
||||
operator()(const Equation_Line & e1,
|
||||
const Equation_Line & e2,
|
||||
OutputIterator res) const
|
||||
{ return AlgebraicFunctors::solve<AK> ( e1, e2, res); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Construct_polynomial_for_circles_2_2
|
||||
{
|
||||
typedef typename AK::RT RT;
|
||||
typedef typename AK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2;
|
||||
|
||||
public:
|
||||
|
||||
typedef Polynomial_for_circles_2_2 result_type;
|
||||
|
||||
result_type
|
||||
operator()(const RT& xc, const RT& yc, const RT& r_sq) const
|
||||
{ return Polynomial_for_circles_2_2(xc, yc, r_sq); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Construct_polynomial_1_2
|
||||
{
|
||||
typedef typename AK::RT RT;
|
||||
typedef typename AK::Polynomial_1_2 Polynomial_1_2;
|
||||
|
||||
public:
|
||||
|
||||
typedef Polynomial_1_2 result_type;
|
||||
|
||||
result_type
|
||||
operator()( const RT& a, const RT& b, const RT& c) const
|
||||
{ return Polynomial_1_2(a, b, c); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Sign_at
|
||||
{
|
||||
typedef typename AK::Polynomial_1_2 Polynomial_1_2;
|
||||
typedef typename AK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
|
||||
public:
|
||||
typedef CGAL::Sign result_type;
|
||||
|
||||
result_type
|
||||
operator()( const Polynomial_for_circles_2_2 & equation,
|
||||
const Root_for_circles_2_2 & r ) const
|
||||
{ return AlgebraicFunctors::sign_at<AK>(equation, r); }
|
||||
|
||||
result_type
|
||||
operator()( const Polynomial_1_2 & equation,
|
||||
const Root_for_circles_2_2 & r ) const
|
||||
{ return AlgebraicFunctors::sign_at<AK>(equation, r); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class X_critical_points
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typedef typename AK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2;
|
||||
|
||||
public:
|
||||
typedef void result_type;
|
||||
|
||||
Root_for_circles_2_2
|
||||
operator()(const Polynomial_for_circles_2_2 & c,
|
||||
bool i) const
|
||||
{ return AlgebraicFunctors::x_critical_point<AK>(c,i); }
|
||||
|
||||
template <class OutputIterator>
|
||||
OutputIterator
|
||||
operator()(const Polynomial_for_circles_2_2 & c,
|
||||
OutputIterator res) const
|
||||
{ return AlgebraicFunctors::x_critical_points<AK>(c,res); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Y_critical_points
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typedef typename AK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2;
|
||||
|
||||
public:
|
||||
typedef void result_type;
|
||||
|
||||
Root_for_circles_2_2
|
||||
operator()(const Polynomial_for_circles_2_2 & c,
|
||||
bool i) const
|
||||
{ return AlgebraicFunctors::y_critical_point<AK>(c,i); }
|
||||
|
||||
template <class OutputIterator>
|
||||
OutputIterator
|
||||
operator()(const Polynomial_for_circles_2_2 & c,
|
||||
OutputIterator res) const
|
||||
{ return AlgebraicFunctors::y_critical_points<AK>(c,res); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Compare_x
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typedef typename AK::RT RT;
|
||||
|
||||
public:
|
||||
typedef CGAL::Comparison_result result_type;
|
||||
|
||||
result_type
|
||||
operator()(const Root_for_circles_2_2& r1,
|
||||
const Root_for_circles_2_2& r2) const
|
||||
{ return AlgebraicFunctors::compare_x<RT>(r1, r2); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Compare_y
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typedef typename AK::RT RT;
|
||||
|
||||
public:
|
||||
typedef CGAL::Comparison_result result_type;
|
||||
|
||||
result_type
|
||||
operator()(const Root_for_circles_2_2& r1,
|
||||
const Root_for_circles_2_2& r2) const
|
||||
{ return AlgebraicFunctors::compare_y<RT>(r1, r2); }
|
||||
|
||||
};
|
||||
|
||||
template < class AK >
|
||||
class Compare_xy
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typedef typename AK::RT RT;
|
||||
|
||||
public:
|
||||
typedef CGAL::Comparison_result result_type;
|
||||
|
||||
result_type
|
||||
operator()(const Root_for_circles_2_2& r1,
|
||||
const Root_for_circles_2_2& r2) const
|
||||
{ return AlgebraicFunctors::compare_xy<RT>(r1, r2); }
|
||||
|
||||
};
|
||||
|
||||
} // namespace AlgebraicFunctors
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTION_OBJECTS_ON_ROOTS_AND_POLYNOMIALS_2_H
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion, Julien Hazebrouck
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_COMPARISON_ROOT_FOR_CIRCLES_2_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_COMPARISON_ROOT_FOR_CIRCLES_2_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
namespace AlgebraicFunctors{
|
||||
|
||||
template <typename RT>
|
||||
Comparison_result
|
||||
compare_x(const CGAL::Root_for_circles_2_2<RT>& r1, const CGAL::Root_for_circles_2_2<RT>& r2){
|
||||
return compare(r1.x(), r2.x());
|
||||
}
|
||||
|
||||
template <typename RT>
|
||||
Comparison_result
|
||||
compare_y(const CGAL::Root_for_circles_2_2<RT>& r1, const CGAL::Root_for_circles_2_2<RT>& r2){
|
||||
return compare(r1.y(), r2.y());
|
||||
}
|
||||
|
||||
template <typename RT>
|
||||
Comparison_result
|
||||
compare_xy(const CGAL::Root_for_circles_2_2<RT>& r1, const CGAL::Root_for_circles_2_2<RT>& r2){
|
||||
Comparison_result compx = compare_x(r1, r2);
|
||||
if(compx != 0)
|
||||
return compx;
|
||||
return compare_y(r1, r2);
|
||||
}
|
||||
|
||||
} // namespace AlgebraicFunctors
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_COMPARISON_ROOT_FOR_CIRCLES_2_2_H
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion, Julien Hazebrouck
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTIONS_ON_ROOTS_AND_POLYNOMIAL_1_2_AND_2_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTIONS_ON_ROOTS_AND_POLYNOMIAL_1_2_AND_2_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
namespace AlgebraicFunctors {
|
||||
|
||||
|
||||
template < class AK, class OutputIterator >
|
||||
inline
|
||||
OutputIterator
|
||||
solve( const typename AK::Polynomial_1_2 & e1,
|
||||
const typename AK::Polynomial_for_circles_2_2 & e2,
|
||||
OutputIterator res )
|
||||
{
|
||||
typedef typename AK::FT FT;
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
if (is_zero(e1.a())){//horizontal line
|
||||
|
||||
const FT hy = -e1.c()/e1.b();
|
||||
const FT hdisc = e2.r_sq() - CGAL::square(hy - e2.b());
|
||||
CGAL::Sign sign_hdisc = CGAL::sign(hdisc);
|
||||
|
||||
if(sign_hdisc == NEGATIVE) return res;
|
||||
if(sign_hdisc == ZERO) {
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(e2.a()),
|
||||
Root_of_2(hy)), 2u);
|
||||
return res;
|
||||
}
|
||||
const Root_of_2 x_res1 = make_root_of_2(e2.a(),FT(-1),hdisc);
|
||||
const Root_of_2 x_res2 = make_root_of_2(e2.a(),FT(1),hdisc);
|
||||
const Root_of_2 y_res = Root_of_2(hy);
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(x_res1, y_res), 1u);
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(x_res2, y_res), 1u);
|
||||
return res;
|
||||
}
|
||||
else if(is_zero(e1.b())){//vertical line
|
||||
|
||||
const FT vx = -e1.c()/e1.a();
|
||||
const FT vdisc = e2.r_sq() - CGAL::square(vx - e2.a());
|
||||
CGAL::Sign sign_vdisc = CGAL::sign(vdisc);
|
||||
|
||||
if(sign_vdisc == NEGATIVE) return res;
|
||||
if(sign_vdisc == ZERO) {
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(vx),
|
||||
Root_of_2(e2.b())), 2u);
|
||||
return res;
|
||||
}
|
||||
|
||||
const Root_of_2 x_res = Root_of_2(vx);
|
||||
const Root_of_2 y_res1 = make_root_of_2(e2.b(),FT(-1),vdisc);
|
||||
const Root_of_2 y_res2 = make_root_of_2(e2.b(),FT(1),vdisc);
|
||||
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(x_res, y_res1), 1u);
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(x_res, y_res2), 1u);
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
|
||||
const FT line_factor = CGAL::square(e1.a()) + CGAL::square(e1.b());
|
||||
const FT disc = line_factor*e2.r_sq() -
|
||||
CGAL::square(e1.a()*e2.a() + e1.b()*e2.b() + e1.c());
|
||||
CGAL::Sign sign_disc = CGAL::sign(disc);
|
||||
|
||||
if (sign_disc == NEGATIVE) return res;
|
||||
|
||||
const FT aux = e1.b()*e2.a() - e1.a()*e2.b();
|
||||
const FT x_base = (aux*e1.b() - e1.a()*e1.c()) / line_factor;
|
||||
const FT y_base = (-aux*e1.a() - e1.b()*e1.c()) / line_factor;
|
||||
|
||||
if (sign_disc == ZERO) {
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(x_base),
|
||||
Root_of_2(y_base)), 2u);
|
||||
return res;
|
||||
}
|
||||
|
||||
// We have two intersection points, whose coordinates are one-root numbers.
|
||||
const FT x_root_coeff = e1.b() / line_factor;
|
||||
const FT y_root_coeff = e1.a() / line_factor;
|
||||
|
||||
if (CGAL::sign(e1.b()) == POSITIVE) {
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, -x_root_coeff, disc),
|
||||
make_root_of_2(y_base, y_root_coeff, disc)), 1u);
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, x_root_coeff, disc),
|
||||
make_root_of_2(y_base, -y_root_coeff, disc)), 1u);
|
||||
} else {
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, x_root_coeff, disc),
|
||||
make_root_of_2(y_base, -y_root_coeff, disc)), 1u);
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, -x_root_coeff, disc),
|
||||
make_root_of_2(y_base, y_root_coeff, disc)), 1u);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
template < class AK, class OutputIterator >
|
||||
inline
|
||||
OutputIterator
|
||||
solve( const typename AK::Polynomial_for_circles_2_2 & e1,
|
||||
const typename AK::Polynomial_1_2 & e2,
|
||||
OutputIterator res )
|
||||
{
|
||||
return solve<AK> (e2, e1, res);
|
||||
}
|
||||
|
||||
template < class AK, class OutputIterator >
|
||||
inline
|
||||
OutputIterator
|
||||
solve( const typename AK::Polynomial_1_2 & e1,
|
||||
const typename AK::Polynomial_1_2 & e2,
|
||||
OutputIterator res )
|
||||
{
|
||||
typedef typename AK::FT FT;
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
//parallele case
|
||||
const FT delta = e1.a()*e2.b() - e2.a()*e1.b();
|
||||
if(is_zero(delta)) return res;
|
||||
//case : e2 horizontal
|
||||
if(is_zero(e2.a())){
|
||||
const FT sol = -e2.c()/e2.b();
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(-(e1.b()*sol + e1.c())/e1.a()),
|
||||
Root_of_2(sol)), 1u);
|
||||
return res;
|
||||
}
|
||||
//general case
|
||||
const FT sol = (e2.a()*e1.c() - e2.c()*e1.a()) / delta;
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(-(e2.b()*sol + e2.c())/e2.a()),
|
||||
Root_of_2(sol)), 1u);
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class AK >
|
||||
inline
|
||||
Sign sign_at( const typename AK::Polynomial_1_2 & equation,
|
||||
const typename AK::Root_for_circles_2_2 & r)
|
||||
{
|
||||
Comparison_result c = compare(r.x()*equation.a(),
|
||||
-equation.c() - r.y()*equation.b());
|
||||
if(c == EQUAL) return ZERO;
|
||||
if(c == LARGER) return POSITIVE;
|
||||
return NEGATIVE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace AlgebraicFunctors
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTIONS_ON_ROOTS_AND_POLYNOMIAL_1_2_AND_2_2_H
|
||||
|
|
@ -1,227 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTIONS_ON_ROOTS_AND_POLYNOMIALS_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTIONS_ON_ROOTS_AND_POLYNOMIALS_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace AlgebraicFunctors {
|
||||
|
||||
template < class AK, class OutputIterator >
|
||||
inline
|
||||
OutputIterator
|
||||
solve( const typename AK::Polynomial_for_circles_2_2 & e1,
|
||||
const typename AK::Polynomial_for_circles_2_2 & e2,
|
||||
OutputIterator res )
|
||||
{
|
||||
CGAL_precondition( ! (e1 == e2) ); // polynomials of this type cannot be multiple
|
||||
// of one another if they are not equal
|
||||
|
||||
typedef typename AK::FT FT;
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
const FT dx = e2.a() - e1.a();
|
||||
const FT dy = e2.b() - e1.b();
|
||||
|
||||
const FT dx2 = CGAL::square(dx);
|
||||
const FT dy2 = CGAL::square(dy);
|
||||
const FT dist2 = dx2 + dy2; // squared distance between centers
|
||||
const FT diff_sqr_rad = e1.r_sq() - e2.r_sq();
|
||||
const FT disc = 2*dist2*(e1.r_sq() + e2.r_sq()) -
|
||||
(CGAL::square(diff_sqr_rad) + CGAL::square(dist2));
|
||||
CGAL::Sign sign_disc = CGAL::sign(disc);
|
||||
|
||||
if (sign_disc == NEGATIVE) return res;
|
||||
|
||||
const FT x_base = ((e1.a() + e2.a()) + dx*diff_sqr_rad / dist2) / 2;
|
||||
const FT y_base = ((e1.b() + e2.b()) + dy*diff_sqr_rad / dist2) / 2;
|
||||
|
||||
if (sign_disc == ZERO) {
|
||||
// one double root,
|
||||
// no need to care about the boolean of the Root_of
|
||||
*res++ = std::make_pair
|
||||
( Root_for_circles_2_2
|
||||
(Root_of_2(x_base), Root_of_2(y_base)),
|
||||
static_cast<unsigned>(2) ); // multiplicity = 2
|
||||
return res;
|
||||
}
|
||||
|
||||
CGAL::Sign sign_dy = CGAL::sign (dy);
|
||||
CGAL::Sign sign_dx = CGAL::sign (dx);
|
||||
|
||||
// else, 2 distinct roots
|
||||
if (sign_dy == ZERO) {
|
||||
const FT y_root_coeff = dx / (2 * dist2);
|
||||
if(sign_dx == NEGATIVE) {
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(x_base),
|
||||
make_root_of_2(y_base, y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(x_base),
|
||||
make_root_of_2(y_base, -y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
} else {
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(x_base),
|
||||
make_root_of_2(y_base, -y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(Root_of_2(x_base),
|
||||
make_root_of_2(y_base, y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
if (sign_dx == ZERO) {
|
||||
const FT x_root_coeff = dy / (2 * dist2);
|
||||
if(sign_dy == POSITIVE) {
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, -x_root_coeff, disc),
|
||||
Root_of_2(y_base)),
|
||||
static_cast<unsigned>(1) );
|
||||
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, x_root_coeff, disc),
|
||||
Root_of_2(y_base)),
|
||||
static_cast<unsigned>(1) );
|
||||
} else {
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, x_root_coeff, disc),
|
||||
Root_of_2(y_base)),
|
||||
static_cast<unsigned>(1) );
|
||||
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, -x_root_coeff, disc),
|
||||
Root_of_2(y_base)),
|
||||
static_cast<unsigned>(1) );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const FT x_root_coeff = dy / (2 * dist2);
|
||||
const FT y_root_coeff = dx / (2 * dist2);
|
||||
|
||||
if (sign_dy == POSITIVE) {
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, -x_root_coeff, disc),
|
||||
make_root_of_2(y_base, y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, x_root_coeff, disc),
|
||||
make_root_of_2(y_base, -y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
} else {
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, x_root_coeff, disc),
|
||||
make_root_of_2(y_base, -y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
* res++ = std::make_pair
|
||||
( Root_for_circles_2_2(make_root_of_2(x_base, -x_root_coeff, disc),
|
||||
make_root_of_2(y_base, y_root_coeff, disc)),
|
||||
static_cast<unsigned>(1) );
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class AK >
|
||||
inline
|
||||
Sign sign_at( const typename AK::Polynomial_for_circles_2_2 & equation,
|
||||
const typename AK::Root_for_circles_2_2 & r)
|
||||
{
|
||||
Comparison_result c = compare(square(r.x() - equation.a()),
|
||||
equation.r_sq() -
|
||||
square(r.y() - equation.b()));
|
||||
if(c == EQUAL) return ZERO;
|
||||
if(c == LARGER) return POSITIVE;
|
||||
return NEGATIVE;
|
||||
}
|
||||
|
||||
|
||||
template <class AK>
|
||||
typename AK::Root_for_circles_2_2
|
||||
x_critical_point(const typename AK::Polynomial_for_circles_2_2 & c,
|
||||
bool i)
|
||||
{
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::FT FT;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
|
||||
const Root_of_2 a1 = make_root_of_2(c.a(),FT(i?-1:1),c.r_sq());
|
||||
return Root_for_circles_2_2(a1, c.b());
|
||||
}
|
||||
|
||||
template <class AK, class OutputIterator>
|
||||
OutputIterator
|
||||
x_critical_points(const typename AK::Polynomial_for_circles_2_2 & c,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename AK::FT FT;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
|
||||
*res++ = Root_for_circles_2_2(
|
||||
make_root_of_2(c.a(),FT(-1),c.r_sq()), c.b());
|
||||
*res++ = Root_for_circles_2_2(
|
||||
make_root_of_2(c.a(),FT(1),c.r_sq()), c.b());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
template <class AK>
|
||||
typename AK::Root_for_circles_2_2
|
||||
y_critical_point(const typename AK::Polynomial_for_circles_2_2 &c,
|
||||
bool i)
|
||||
{
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::FT FT;
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
|
||||
const Root_of_2 b1 = make_root_of_2(c.b(),FT(i?-1:1),c.r_sq());
|
||||
return Root_for_circles_2_2(c.a(),b1);
|
||||
}
|
||||
|
||||
template <class AK, class OutputIterator>
|
||||
OutputIterator
|
||||
y_critical_points(const typename AK::Polynomial_for_circles_2_2 & c,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
|
||||
*res++ = Root_for_circles_2_2(c.a(),
|
||||
make_root_of_2(c.b(),-1,c.r_sq()));
|
||||
*res++ = Root_for_circles_2_2(c.a(),
|
||||
make_root_of_2(c.b(),1,c.r_sq()));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace AlgebraicFunctors
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_FUNCTIONS_ON_ROOTS_AND_POLYNOMIALS_2_H
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_2_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_2_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Quotient.h>
|
||||
#include <CGAL/Root_of_traits.h>
|
||||
#include <CGAL/Polynomials_2_2.h>
|
||||
#include <CGAL/Polynomials_1_2.h>
|
||||
#include <CGAL/Root_for_circles_2_2.h>
|
||||
|
||||
#include <CGAL/Algebraic_kernel_for_circles/function_objects_on_roots_and_polynomials_2_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template< class RT_ >
|
||||
struct Algebraic_kernel_for_circles_2_2
|
||||
{
|
||||
typedef Algebraic_kernel_for_circles_2_2<RT_> Self;
|
||||
|
||||
typedef RT_ RT;
|
||||
typedef typename Root_of_traits< RT >::RootOf_1 FT;
|
||||
|
||||
typedef CGAL::Polynomial_1_2<RT> Polynomial_1_2;
|
||||
typedef CGAL::Polynomial_for_circles_2_2<RT> Polynomial_for_circles_2_2;
|
||||
// problem RT / FT ?
|
||||
|
||||
typedef typename Root_of_traits< RT >::RootOf_2 Root_of_2;
|
||||
typedef CGAL::Root_for_circles_2_2< RT > Root_for_circles_2_2;
|
||||
|
||||
typedef AlgebraicFunctors::Construct_polynomial_1_2<Self>
|
||||
Construct_polynomial_1_2;
|
||||
typedef AlgebraicFunctors::Construct_polynomial_for_circles_2_2<Self>
|
||||
Construct_polynomial_for_circles_2_2;
|
||||
|
||||
typedef AlgebraicFunctors::Solve<Self> Solve;
|
||||
typedef AlgebraicFunctors::Sign_at<Self> Sign_at;
|
||||
typedef AlgebraicFunctors::X_critical_points<Self> X_critical_points;
|
||||
typedef AlgebraicFunctors::Y_critical_points<Self> Y_critical_points;
|
||||
typedef AlgebraicFunctors::Compare_x<Self> Compare_x;
|
||||
typedef AlgebraicFunctors::Compare_y<Self> Compare_y;
|
||||
typedef AlgebraicFunctors::Compare_xy<Self> Compare_xy;
|
||||
|
||||
Construct_polynomial_1_2
|
||||
construct_polynomial_1_2_object() const
|
||||
{ return Construct_polynomial_1_2(); }
|
||||
|
||||
Construct_polynomial_for_circles_2_2
|
||||
construct_polynomial_for_circles_2_2_object() const
|
||||
{ return Construct_polynomial_for_circles_2_2(); }
|
||||
|
||||
Solve solve_object() const
|
||||
{ return Solve(); }
|
||||
|
||||
Sign_at sign_at_object() const
|
||||
{ return Sign_at(); }
|
||||
|
||||
X_critical_points x_critical_points_object() const
|
||||
{ return X_critical_points(); }
|
||||
|
||||
Y_critical_points y_critical_points_object() const
|
||||
{ return Y_critical_points(); }
|
||||
|
||||
Compare_x compare_x_object() const
|
||||
{ return Compare_x(); }
|
||||
|
||||
Compare_y compare_y_object() const
|
||||
{ return Compare_y(); }
|
||||
|
||||
Compare_xy compare_xy_object() const
|
||||
{ return Compare_xy(); }
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_2_2_H
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_POLYNOMIALS_1_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_POLYNOMIALS_1_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
#include <CGAL/enum.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < typename RT_ >
|
||||
class Polynomial_1_2
|
||||
{
|
||||
RT_ rep[3]; // stores a, b, c for line ax+by+c=0
|
||||
|
||||
public:
|
||||
|
||||
typedef RT_ RT;
|
||||
|
||||
Polynomial_1_2(){}
|
||||
|
||||
Polynomial_1_2(const RT & a, const RT & b, const RT & c)
|
||||
{
|
||||
rep[0]=a;
|
||||
rep[1]=b;
|
||||
rep[2]=c;
|
||||
}
|
||||
|
||||
const RT & a() const
|
||||
{ return rep[0]; }
|
||||
|
||||
const RT & b() const
|
||||
{ return rep[1]; }
|
||||
|
||||
const RT & c() const
|
||||
{ return rep[2]; }
|
||||
};
|
||||
|
||||
template < typename RT >
|
||||
bool
|
||||
operator == ( const Polynomial_1_2<RT> & p1,
|
||||
const Polynomial_1_2<RT> & p2 )
|
||||
{
|
||||
return( (p1.a() == p2.a()) &&
|
||||
(p1.b() == p2.b()) &&
|
||||
(p1.c() == p2.c()) );
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_POLYNOMIALS_1_2_H
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_POLYNOMIALS_2_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_POLYNOMIALS_2_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
//////////// FIXME - pb RT (cas general Polynomial_2_2) ou FT (ici)
|
||||
|
||||
#include <CGAL/enum.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// polynomials of the form (X-a)^2 + (Y-b)^2 - R^2
|
||||
template < typename FT_ >
|
||||
class Polynomial_for_circles_2_2
|
||||
{
|
||||
FT_ rep[3]; // stores a, b, R^2
|
||||
|
||||
public:
|
||||
|
||||
typedef FT_ FT;
|
||||
|
||||
Polynomial_for_circles_2_2(){}
|
||||
|
||||
Polynomial_for_circles_2_2(const FT & a, const FT & b, const FT & rsq)
|
||||
{
|
||||
rep[0]=a;
|
||||
rep[1]=b;
|
||||
rep[2]=rsq;
|
||||
}
|
||||
|
||||
const FT & a() const
|
||||
{ return rep[0]; }
|
||||
|
||||
const FT & b() const
|
||||
{ return rep[1]; }
|
||||
|
||||
const FT & r_sq() const
|
||||
{ return rep[2]; }
|
||||
};
|
||||
|
||||
template < typename FT >
|
||||
bool
|
||||
operator == ( const Polynomial_for_circles_2_2<FT> & p1,
|
||||
const Polynomial_for_circles_2_2<FT> & p2 )
|
||||
{
|
||||
return( (p1.a() == p2.a()) &&
|
||||
(p1.b() == p2.b()) &&
|
||||
(p1.r_sq() == p2.r_sq()) );
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_POLYNOMIALS_2_2_H
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// Partially supported by the IST Programme of the EU as a Shared-cost
|
||||
// RTD (FET Open) Project under Contract No IST-2000-26473
|
||||
// (ECG - Effective Computational Geometry for Curves and Surfaces)
|
||||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#ifndef CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_ROOT_FOR_CIRCLES_2_2_H
|
||||
#define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_ROOT_FOR_CIRCLES_2_2_H
|
||||
|
||||
#include <CGAL/license/Circular_kernel_2.h>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <CGAL/Bbox_2.h>
|
||||
#include <CGAL/Root_of_traits.h>
|
||||
#include <CGAL/Handle_for.h>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < typename RT_ >
|
||||
class Root_for_circles_2_2 {
|
||||
|
||||
typedef RT_ RT;
|
||||
typedef typename Root_of_traits< RT >::RootOf_2 Root_of_2;
|
||||
typedef typename Root_of_traits< RT >::RootOf_1 FT;
|
||||
|
||||
private:
|
||||
Handle_for<Root_of_2> x_;
|
||||
Handle_for<Root_of_2> y_;
|
||||
|
||||
public:
|
||||
Root_for_circles_2_2(){}
|
||||
|
||||
Root_for_circles_2_2(const Root_of_2& r1, const Root_of_2& r2)
|
||||
: x_(r1), y_(r2)
|
||||
{
|
||||
// When it is an interval this assertion dont compile
|
||||
//CGAL_assertion((r1.is_rational() || r2.is_rational()) ||
|
||||
// (r1.gamma() == r2.gamma()));
|
||||
}
|
||||
|
||||
const Root_of_2& x() const
|
||||
{ return get_pointee_or_identity(x_); }
|
||||
|
||||
const Root_of_2& y() const
|
||||
{ return get_pointee_or_identity(y_); }
|
||||
|
||||
CGAL::Bbox_2 bbox() const
|
||||
{
|
||||
CGAL::Interval_nt<>
|
||||
ix=to_interval(x()),
|
||||
iy=to_interval(y());
|
||||
return CGAL::Bbox_2(ix.inf(),iy.inf(),
|
||||
ix.sup(),iy.sup());
|
||||
/*
|
||||
const Root_of_2 &ox = x();
|
||||
const Root_of_2 &oy = y();
|
||||
|
||||
if(ox.is_rational() || oy.is_rational()) {
|
||||
CGAL::Interval_nt<>
|
||||
ix=to_interval(ox),
|
||||
iy=to_interval(oy);
|
||||
return CGAL::Bbox_2(ix.inf(),iy.inf(),
|
||||
ix.sup(),iy.sup());
|
||||
}
|
||||
|
||||
// delta must be the same
|
||||
// WE HAVE TO TEST THE EXECUTION TIME
|
||||
// IT STILL NOT POSSIBLE BECAUSE OF THE
|
||||
// PROBLEM ON THE ARRANGEMENT
|
||||
// (it is very likely to make it better with this changing)
|
||||
const CGAL::Interval_nt<true> alpha1 = to_interval(ox.alpha());
|
||||
const CGAL::Interval_nt<true> beta1 = to_interval(ox.beta());
|
||||
const CGAL::Interval_nt<true> alpha2 = to_interval(oy.alpha());
|
||||
const CGAL::Interval_nt<true> beta2 = to_interval(oy.beta());
|
||||
const CGAL::Interval_nt<true> g = to_interval(ox.gamma());
|
||||
const CGAL::Interval_nt<true> sqrtg = CGAL::sqrt(g);
|
||||
const CGAL::Interval_nt<true> ix = alpha1 + beta1 * sqrtg;
|
||||
const CGAL::Interval_nt<true> iy = alpha2 + beta2 * sqrtg;
|
||||
return CGAL::Bbox_2(ix.inf(),iy.inf(),
|
||||
ix.sup(),iy.sup());
|
||||
*/
|
||||
}
|
||||
|
||||
template < typename RT >
|
||||
friend bool operator == ( const Root_for_circles_2_2<RT>& r1,
|
||||
const Root_for_circles_2_2<RT>& r2 );
|
||||
|
||||
};
|
||||
|
||||
template < typename RT >
|
||||
bool
|
||||
operator == ( const Root_for_circles_2_2<RT>& r1,
|
||||
const Root_for_circles_2_2<RT>& r2 )
|
||||
{ if (CGAL::identical(r1.x_, r2.x_) && CGAL::identical(r1.y_, r2.y_))
|
||||
return true;
|
||||
return (r1.x() == r2.x()) && (r1.y() == r2.y());
|
||||
}
|
||||
|
||||
template < typename RT >
|
||||
std::ostream &
|
||||
operator<<(std::ostream & os, const Root_for_circles_2_2<RT> &r)
|
||||
{ return os << r.x() << " " << r.y() << " "; }
|
||||
|
||||
template < typename RT >
|
||||
std::istream &
|
||||
operator>>(std::istream & is, Root_for_circles_2_2<RT> &r)
|
||||
{
|
||||
typedef typename Root_of_traits< RT >::RootOf_2 Root_of_2;
|
||||
Root_of_2 x,y;
|
||||
|
||||
is >> x >> y;
|
||||
if(is)
|
||||
r = Root_for_circles_2_2<RT>(x,y);
|
||||
return is;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_ROOT_FOR_CIRCLES_2_2_H
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
INRIA Sophia-Antipolis (France)
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
Algebraic_foundations
|
||||
Algebraic_kernel_for_circles
|
||||
Arithmetic_kernel
|
||||
Filtered_kernel
|
||||
Installation
|
||||
Interval_support
|
||||
Kernel_23
|
||||
Modular_arithmetic
|
||||
Number_types
|
||||
Profiling_tools
|
||||
STL_Extension
|
||||
Stream_support
|
||||
|
|
@ -1 +0,0 @@
|
|||
GPL (v3 or later)
|
||||
|
|
@ -1 +0,0 @@
|
|||
Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_kernel_for_circles_Tests )
|
||||
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include_directories (BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#include <CGAL/Random.h>
|
||||
#include <cassert>
|
||||
|
||||
template <class AK>
|
||||
void _test_constuctor(AK ak)
|
||||
{
|
||||
CGAL::Random generatorOfgenerator;
|
||||
int random_seed = generatorOfgenerator.get_int(0, 123456);
|
||||
std::cout << "random_seed = " << random_seed << std::endl;
|
||||
CGAL::Random theRandom(random_seed);
|
||||
int random_max = 127;
|
||||
int random_min = -127;
|
||||
typename AK::Construct_polynomial_for_circles_2_2 theConstruct_2_2 =
|
||||
ak.construct_polynomial_for_circles_2_2_object();
|
||||
typename AK::Construct_polynomial_1_2 theConstruct_1_2 =
|
||||
ak.construct_polynomial_1_2_object();
|
||||
|
||||
for(int i = 0; i < 20 ; i++){
|
||||
int x = theRandom.get_int(random_min,random_max);
|
||||
int y = theRandom.get_int(random_min,random_max);
|
||||
int r_sq = theRandom.get_int(random_min,random_max);
|
||||
int a = theRandom.get_int(random_min,random_max);
|
||||
int b = theRandom.get_int(random_min,random_max);
|
||||
int c = theRandom.get_int(random_min,random_max);
|
||||
|
||||
typename AK::Polynomial_for_circles_2_2 p_2_2 = theConstruct_2_2(x, y, r_sq);
|
||||
typename AK::Polynomial_1_2 p_1_2 = theConstruct_1_2(a, b, c);
|
||||
assert(p_2_2.a() == x);
|
||||
assert(p_2_2.b() == y);
|
||||
assert(p_2_2.r_sq() == r_sq);
|
||||
assert(p_1_2.a() == a);
|
||||
assert(p_1_2.b() == b);
|
||||
assert(p_1_2.c() == c);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,414 +0,0 @@
|
|||
#include <CGAL/Random.h>
|
||||
#include <cassert>
|
||||
|
||||
template <class AK>
|
||||
void _test_solve(AK ak)
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typename AK::Solve theSolve =
|
||||
ak.solve_object();
|
||||
|
||||
//Polynomial_for_circles_2_2
|
||||
typename AK::Construct_polynomial_for_circles_2_2 theConstruct_2_2 =
|
||||
ak.construct_polynomial_for_circles_2_2_object();
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res1;
|
||||
theSolve(theConstruct_2_2(5, 5, 25),
|
||||
theConstruct_2_2(0, 5, 100),
|
||||
std::back_inserter(res1));
|
||||
assert(res1.size() == 1);
|
||||
assert(res1[0].second == 2u);
|
||||
assert(res1[0].first == Root_for_circles_2_2(10, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res2;
|
||||
theSolve(theConstruct_2_2(-5, 5, 25),
|
||||
theConstruct_2_2(0, 5, 100),
|
||||
std::back_inserter(res2));
|
||||
assert(res2.size() == 1);
|
||||
assert(res2[0].second == 2u);
|
||||
assert(res2[0].first == Root_for_circles_2_2(-10, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res3;
|
||||
theSolve(theConstruct_2_2(0, 5, 25),
|
||||
theConstruct_2_2(0, 0, 100),
|
||||
std::back_inserter(res3));
|
||||
assert(res3.size() == 1);
|
||||
assert(res3[0].second == 2u);
|
||||
assert(res3[0].first == Root_for_circles_2_2(0, 10));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res4;
|
||||
theSolve(theConstruct_2_2(0, -5, 25),
|
||||
theConstruct_2_2(0, 0, 100),
|
||||
std::back_inserter(res4));
|
||||
assert(res4.size() == 1);
|
||||
assert(res4[0].second == 2u);
|
||||
assert(res4[0].first == Root_for_circles_2_2(0, -10));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res5;
|
||||
theSolve(theConstruct_2_2(-5, 5, 25),
|
||||
theConstruct_2_2(0, 0, 25),
|
||||
std::back_inserter(res5));
|
||||
assert(res5.size() == 2);
|
||||
assert(res5[0].second == 1u);
|
||||
assert(res5[0].first == Root_for_circles_2_2(-5, 0));
|
||||
assert(res5[1].second == 1u);
|
||||
assert(res5[1].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
//Polynomial_1_2 Polynomial_for_circles_2_2
|
||||
typename AK::Construct_polynomial_1_2 theConstruct_1_2 =
|
||||
ak.construct_polynomial_1_2_object();
|
||||
|
||||
//line horizontal in circle's center
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res6;
|
||||
theSolve(theConstruct_1_2(0, 1, -5),
|
||||
theConstruct_2_2(0, 5, 100),
|
||||
std::back_inserter(res6));
|
||||
assert(res6.size() == 2);
|
||||
assert(res6[0].second == 1u);
|
||||
assert(res6[0].first == Root_for_circles_2_2(-10, 5));
|
||||
assert(res6[1].second == 1u);
|
||||
assert(res6[1].first == Root_for_circles_2_2(10, 5));
|
||||
|
||||
//line vertical in circle's center
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res7;
|
||||
theSolve(theConstruct_1_2(1, 0, -5),
|
||||
theConstruct_2_2(5, 5, 100),
|
||||
std::back_inserter(res7));
|
||||
assert(res7.size() == 2);
|
||||
assert(res7[0].second == 1u);
|
||||
assert(res7[0].first == Root_for_circles_2_2(5, -5));
|
||||
assert(res7[1].second == 1u);
|
||||
assert(res7[1].first == Root_for_circles_2_2(5, 15));
|
||||
|
||||
//line vertical tangent left
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res8;
|
||||
theSolve(theConstruct_1_2(1, 0, 5),
|
||||
theConstruct_2_2(5, 5, 100),
|
||||
std::back_inserter(res8));
|
||||
assert(res8.size() == 1);
|
||||
assert(res8[0].second == 2u);
|
||||
assert(res8[0].first == Root_for_circles_2_2(-5, 5));
|
||||
|
||||
//line vertical tangent right
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res9;
|
||||
theSolve(theConstruct_1_2(1, 0, -15),
|
||||
theConstruct_2_2(5, 5, 100),
|
||||
std::back_inserter(res9));
|
||||
assert(res9.size() == 1);
|
||||
assert(res9[0].second == 2u);
|
||||
assert(res9[0].first == Root_for_circles_2_2(15, 5));
|
||||
|
||||
//line horizontal tangent on top
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res10;
|
||||
theSolve(theConstruct_1_2(0, 1, -15),
|
||||
theConstruct_2_2(5, 5, 100),
|
||||
std::back_inserter(res10));
|
||||
assert(res10.size() == 1);
|
||||
assert(res10[0].second == 2u);
|
||||
assert(res10[0].first == Root_for_circles_2_2(5, 15));
|
||||
|
||||
//line horizontal tangent down
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res11;
|
||||
theSolve(theConstruct_1_2(0, 1, 5),
|
||||
theConstruct_2_2(5, 5, 100),
|
||||
std::back_inserter(res11));
|
||||
assert(res11.size() == 1);
|
||||
assert(res11[0].second == 2u);
|
||||
assert(res11[0].first == Root_for_circles_2_2(5, -5));
|
||||
|
||||
|
||||
// only Polynomial_1_2
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res12;
|
||||
theSolve(theConstruct_1_2(1, 1, -5),
|
||||
theConstruct_1_2(1, -1, 5),
|
||||
std::back_inserter(res12));
|
||||
assert(res12.size() == 1);
|
||||
assert(res12[0].second == 1u);
|
||||
assert(res12[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res13;
|
||||
theSolve(theConstruct_1_2(0, 1, -5),
|
||||
theConstruct_1_2(1, -1, 5),
|
||||
std::back_inserter(res13));
|
||||
assert(res13.size() == 1);
|
||||
assert(res13[0].second == 1u);
|
||||
assert(res13[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res14;
|
||||
theSolve(theConstruct_1_2(1, -1, 5),
|
||||
theConstruct_1_2(0, 1, -5),
|
||||
std::back_inserter(res14));
|
||||
assert(res14.size() == 1);
|
||||
assert(res14[0].second == 1u);
|
||||
assert(res14[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res15;
|
||||
theSolve(theConstruct_1_2(1, 0, 0),
|
||||
theConstruct_1_2(1, -1, 5),
|
||||
std::back_inserter(res15));
|
||||
assert(res15.size() == 1);
|
||||
assert(res15[0].second == 1u);
|
||||
assert(res15[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res16;
|
||||
theSolve(theConstruct_1_2(1, -1, 5),
|
||||
theConstruct_1_2(1, 0, 0),
|
||||
std::back_inserter(res16));
|
||||
assert(res16.size() == 1);
|
||||
assert(res16[0].second == 1u);
|
||||
assert(res16[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res17;
|
||||
theSolve(theConstruct_1_2(0, 1, -5),
|
||||
theConstruct_1_2(1, 0, 0),
|
||||
std::back_inserter(res17));
|
||||
assert(res17.size() == 1);
|
||||
assert(res17[0].second == 1u);
|
||||
assert(res17[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res18;
|
||||
theSolve(theConstruct_1_2(1, 0, 0),
|
||||
theConstruct_1_2(0, 1, -5),
|
||||
std::back_inserter(res18));
|
||||
assert(res18.size() == 1);
|
||||
assert(res18[0].second == 1u);
|
||||
assert(res18[0].first == Root_for_circles_2_2(0, 5));
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res19;
|
||||
theSolve(theConstruct_1_2(1, 0, 0),
|
||||
theConstruct_1_2(1, 0, 0),
|
||||
std::back_inserter(res19));
|
||||
assert(res19.size() == 0);
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res20;
|
||||
theSolve(theConstruct_1_2(1, 0, 0),
|
||||
theConstruct_1_2(1, 0, 5),
|
||||
std::back_inserter(res20));
|
||||
assert(res20.size() == 0);
|
||||
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res21;
|
||||
theSolve(theConstruct_1_2(0, 1, -5),
|
||||
theConstruct_1_2(0, 1, -5),
|
||||
std::back_inserter(res21));
|
||||
assert(res21.size() == 0);
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res22;
|
||||
theSolve(theConstruct_1_2(0, 1, -5),
|
||||
theConstruct_1_2(0, 1, 0),
|
||||
std::back_inserter(res22));
|
||||
assert(res22.size() == 0);
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res23;
|
||||
theSolve(theConstruct_1_2(1, -1, 5),
|
||||
theConstruct_1_2(1, -1, 5),
|
||||
std::back_inserter(res23));
|
||||
assert(res23.size() == 0);
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res24;
|
||||
theSolve(theConstruct_1_2(1, -1, 5),
|
||||
theConstruct_1_2(2, -2, 15),
|
||||
std::back_inserter(res24));
|
||||
assert(res24.size() == 0);
|
||||
|
||||
CGAL::Random generatorOfgenerator;
|
||||
int random_seed = generatorOfgenerator.get_int(0, 123456);
|
||||
std::cout << "random_seed = " << random_seed << std::endl;
|
||||
CGAL::Random theRandom(random_seed);
|
||||
int random_max = 5;
|
||||
int random_min = -5;
|
||||
|
||||
typename AK::Sign_at theSigh_at =
|
||||
ak.sign_at_object();
|
||||
|
||||
for(std::size_t i = 0; i < 500; i++){
|
||||
int a1, b1, c1, a2, b2, c2, a3, b3, r_sq = 0;
|
||||
do{
|
||||
a1 = theRandom.get_int(random_min,random_max);
|
||||
b1 = theRandom.get_int(random_min,random_max);
|
||||
}while((a1 == 0) && (b1 == 0));
|
||||
c1 = theRandom.get_int(random_min,random_max);
|
||||
do{
|
||||
a2 = theRandom.get_int(random_min,random_max);
|
||||
b2 = theRandom.get_int(random_min,random_max);
|
||||
}while((a2 == 0) && (b2 == 0));
|
||||
c2 = theRandom.get_int(random_min,random_max);
|
||||
a3 = theRandom.get_int(random_min,random_max);
|
||||
b3 = theRandom.get_int(random_min,random_max);
|
||||
r_sq = theRandom.get_int(1,random_max);
|
||||
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res;
|
||||
theSolve(theConstruct_1_2(a1, b1, c1),
|
||||
theConstruct_1_2(a2, b2, c2),
|
||||
std::back_inserter(res));
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res2;
|
||||
theSolve(theConstruct_1_2(a2, b2, c2),
|
||||
theConstruct_2_2(a3, b3, r_sq),
|
||||
std::back_inserter(res2));
|
||||
std::vector< std::pair<Root_for_circles_2_2, size_t> > res3;
|
||||
theSolve(theConstruct_1_2(a1, b1, c1),
|
||||
theConstruct_2_2(a3, b3, r_sq),
|
||||
std::back_inserter(res3));
|
||||
for (std::size_t j = 0 ; j < res.size() ; j++){
|
||||
assert(res[j].second == 1u);
|
||||
assert(theSigh_at(theConstruct_1_2(a1, b1, c1),
|
||||
res[j].first) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_1_2(a2, b2, c2),
|
||||
res[j].first) == CGAL::ZERO);
|
||||
}
|
||||
for (std::size_t j = 0 ; j < res2.size() ; j++){
|
||||
if(res2.size() == 1) assert(res2[j].second == 2u);
|
||||
if(res2.size() == 2) assert(res2[j].second == 1u);
|
||||
assert(theSigh_at(theConstruct_2_2(a3, b3, r_sq),
|
||||
res2[j].first) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_1_2(a2, b2, c2),
|
||||
res2[j].first) == CGAL::ZERO);
|
||||
}
|
||||
for (std::size_t j = 0 ; j < res3.size() ; j++){
|
||||
if(res3.size() == 1) assert(res3[j].second == 2u);
|
||||
if(res3.size() == 2) assert(res3[j].second == 1u);
|
||||
assert(theSigh_at(theConstruct_2_2(a3, b3, r_sq),
|
||||
res3[j].first) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_1_2(a1, b1, c1),
|
||||
res3[j].first) == CGAL::ZERO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <class AK>
|
||||
void _test_sign_at(AK ak)
|
||||
{
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typename AK::Sign_at theSigh_at =
|
||||
ak.sign_at_object();
|
||||
|
||||
//Polynomial_for_circles_2_2
|
||||
typename AK::Construct_polynomial_for_circles_2_2 theConstruct_2_2 =
|
||||
ak.construct_polynomial_for_circles_2_2_object();
|
||||
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(-5,5)) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(15,5)) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(5,15)) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(5,-5)) == CGAL::ZERO);
|
||||
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(5,5)) != CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(5,16)) != CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_2_2(5, 5, 100),
|
||||
Root_for_circles_2_2(5,-6)) != CGAL::ZERO);
|
||||
|
||||
//Polynomial_1_2
|
||||
typename AK::Construct_polynomial_1_2 theConstruct_1_2 =
|
||||
ak.construct_polynomial_1_2_object();
|
||||
|
||||
assert(theSigh_at(theConstruct_1_2(1, 0, -5),
|
||||
Root_for_circles_2_2(5,-6)) == CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_1_2(1, 0, -5),
|
||||
Root_for_circles_2_2(6,-6)) != CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_1_2(0, 1, -5),
|
||||
Root_for_circles_2_2(5,-6)) != CGAL::ZERO);
|
||||
assert(theSigh_at(theConstruct_1_2(0, 1, -5),
|
||||
Root_for_circles_2_2(5, 5)) == CGAL::ZERO);
|
||||
|
||||
}
|
||||
|
||||
template <class AK>
|
||||
void _test_critical_points(AK ak)
|
||||
{
|
||||
CGAL::Random generatorOfgenerator;
|
||||
int random_seed = generatorOfgenerator.get_int(0, 123456);
|
||||
std::cout << "random_seed = " << random_seed << std::endl;
|
||||
CGAL::Random theRandom(random_seed);
|
||||
int random_max = 127;
|
||||
int random_min = -127;
|
||||
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
typename AK::Construct_polynomial_for_circles_2_2 theConstruct_2_2 =
|
||||
ak.construct_polynomial_for_circles_2_2_object();
|
||||
typename AK::X_critical_points theX_critical_points =
|
||||
ak.x_critical_points_object();
|
||||
|
||||
typename AK::Y_critical_points theY_critical_points =
|
||||
ak.y_critical_points_object();
|
||||
|
||||
for(int i = 0; i < 20; i++){
|
||||
int x = theRandom.get_int(random_min,random_max);
|
||||
int y = theRandom.get_int(random_min,random_max);
|
||||
int r = theRandom.get_int(1,random_max);
|
||||
|
||||
assert(theX_critical_points(theConstruct_2_2(x,y,r*r),true)
|
||||
== Root_for_circles_2_2(x - r, y));
|
||||
assert(theX_critical_points(theConstruct_2_2(x,y,r*r),false)
|
||||
== Root_for_circles_2_2(x + r, y));
|
||||
assert(theY_critical_points(theConstruct_2_2(x,y,r*r),true)
|
||||
== Root_for_circles_2_2(x, y - r));
|
||||
assert(theY_critical_points(theConstruct_2_2(x,y,r*r),false)
|
||||
== Root_for_circles_2_2(x, y + r));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <class AK>
|
||||
void _test_compare_Root_for_circles(AK ak)
|
||||
{
|
||||
CGAL::Random generatorOfgenerator;
|
||||
int random_seed = generatorOfgenerator.get_int(0, 123456);
|
||||
std::cout << "random_seed = " << random_seed << std::endl;
|
||||
CGAL::Random theRandom(random_seed);
|
||||
int random_max = 127;
|
||||
int random_min = -127;
|
||||
|
||||
typedef typename AK::Root_for_circles_2_2 Root_for_circles_2_2;
|
||||
|
||||
typename AK::Compare_x theCompare_x =
|
||||
ak.compare_x_object();
|
||||
|
||||
typename AK::Compare_y theCompare_y =
|
||||
ak.compare_y_object();
|
||||
|
||||
typename AK::Compare_xy theCompare_xy =
|
||||
ak.compare_xy_object();
|
||||
|
||||
for (int i = 0; i < 20; i++){
|
||||
Root_for_circles_2_2 r1(theRandom.get_int(random_min,random_max),
|
||||
theRandom.get_int(random_min,random_max));
|
||||
Root_for_circles_2_2 r2(theRandom.get_int(random_min,random_max),
|
||||
theRandom.get_int(random_min,random_max));
|
||||
if(r1.x() > r2.x()){
|
||||
assert(theCompare_x(r1, r2) == CGAL::LARGER);
|
||||
assert(theCompare_xy(r1, r2) == CGAL::LARGER);
|
||||
}
|
||||
else if(r1.x() == r2.x()){
|
||||
assert(theCompare_x(r1, r2) == CGAL::EQUAL);
|
||||
if(r1.y() < r2.y()){
|
||||
assert(theCompare_y(r1, r2) == CGAL::SMALLER);
|
||||
assert(theCompare_xy(r1, r2) == CGAL::SMALLER);
|
||||
}
|
||||
else if(r1.y() > r2.y()){
|
||||
assert(theCompare_y(r1, r2) == CGAL::LARGER);
|
||||
assert(theCompare_xy(r1, r2) == CGAL::LARGER);
|
||||
}
|
||||
else {
|
||||
assert(theCompare_y(r1, r2) == CGAL::EQUAL);
|
||||
assert(theCompare_xy(r1, r2) == CGAL::EQUAL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert(theCompare_x(r1, r2) == CGAL::SMALLER);
|
||||
assert(theCompare_xy(r1, r2) == CGAL::SMALLER);
|
||||
}
|
||||
if(r1.y() > r2.y())
|
||||
assert(theCompare_y(r1, r2) == CGAL::LARGER);
|
||||
else if(r1.y() < r2.y())
|
||||
assert(theCompare_y(r1, r2) == CGAL::SMALLER);
|
||||
else
|
||||
assert(theCompare_y(r1, r2) == CGAL::EQUAL);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/Quotient.h>
|
||||
#include <CGAL/_test_predicates.h>
|
||||
#include <CGAL/_test_constructor.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef CGAL::Quotient<CGAL::MP_Float> NT1;
|
||||
typedef CGAL::Algebraic_kernel_for_circles_2_2<NT1> Algebraic_k1;
|
||||
Algebraic_k1 ak1;
|
||||
_test_solve(ak1);
|
||||
_test_sign_at(ak1);
|
||||
_test_critical_points(ak1);
|
||||
_test_compare_Root_for_circles(ak1);
|
||||
_test_constuctor(ak1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -5,11 +5,7 @@ if(CGAL_Core_FOUND)
|
|||
|
||||
collect_cgal_library(CGAL_Core "")
|
||||
|
||||
if(CGAL_HEADER_ONLY)
|
||||
set(keyword INTERFACE)
|
||||
else()
|
||||
set(keyword PUBLIC)
|
||||
endif()
|
||||
set(keyword INTERFACE)
|
||||
|
||||
CGAL_setup_CGAL_Core_dependencies(CGAL_Core ${keyword})
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ collect_cgal_library( CGAL_ImageIO "")
|
|||
|
||||
include(CGAL_SetupCGAL_ImageIODependencies)
|
||||
|
||||
if(CGAL_HEADER_ONLY)
|
||||
set(keyword "INTERFACE")
|
||||
endif()
|
||||
set(keyword "INTERFACE")
|
||||
|
||||
CGAL_setup_CGAL_ImageIO_dependencies(CGAL_ImageIO ${keyword})
|
||||
|
||||
|
|
|
|||
|
|
@ -13,16 +13,10 @@ if(CGAL_Qt5_MISSING_DEPS)
|
|||
endif()
|
||||
|
||||
message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" )
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
collect_cgal_library( CGAL_Qt5 "${_CGAL_Qt5_MOC_FILES_private};${_CGAL_Qt5_RESOURCE_FILES_private};${_CGAL_Qt5_UI_FILES}")
|
||||
target_include_directories( CGAL_Qt5 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
else()
|
||||
collect_cgal_library( CGAL_Qt5 "")
|
||||
endif()
|
||||
|
||||
if(CGAL_HEADER_ONLY)
|
||||
set(keyword "INTERFACE")
|
||||
endif()
|
||||
collect_cgal_library( CGAL_Qt5 "")
|
||||
|
||||
set(keyword "INTERFACE")
|
||||
|
||||
CGAL_setup_CGAL_Qt5_dependencies( CGAL_Qt5 ${keyword})
|
||||
|
||||
|
|
@ -32,9 +26,7 @@ if(COMMAND add_config_flag)
|
|||
endif()
|
||||
|
||||
install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/Qt" COMPONENT CGAL_Qt5)
|
||||
if (CGAL_HEADER_ONLY)
|
||||
install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt5)
|
||||
install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt5)
|
||||
endif()
|
||||
install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt5)
|
||||
install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt5)
|
||||
|
||||
message("libCGAL_Qt5 is configured")
|
||||
|
|
|
|||
|
|
@ -23,13 +23,6 @@ endif()
|
|||
# Use GNUInstallDirs to get canonical paths
|
||||
include(GNUInstallDirs)
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# -= HEADER ONLY =-
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
option(CGAL_HEADER_ONLY "Enable header-only mode of CGAL (no compilation of CGAL libraries)" TRUE)
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# -= PACKAGE SETUP =-
|
||||
|
|
@ -618,10 +611,6 @@ cache_set(CGAL_3RD_PARTY_LIBRARIES_DIRS "" )
|
|||
# this; e.g. in MPFI/RS in Algebraic_kernel_d. For these cases CGAL
|
||||
# and the example/test must be configured with MPFI (just one is not sufficient)
|
||||
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
include(CGAL_SetupDependencies)
|
||||
endif()
|
||||
|
||||
message("== Detect external libraries (DONE) ==\n")
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
|
|
@ -630,70 +619,6 @@ message("== Detect external libraries (DONE) ==\n")
|
|||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
# The variables set are the #defines expected by compiler_config.h
|
||||
# Note: CMake will not notice when files are added or removed
|
||||
# but this is probably OK for the installation procedure.
|
||||
|
||||
message("== Write compiler_config.h ==")
|
||||
|
||||
macro(add_config_flag flag)
|
||||
if(${flag})
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "#define ${flag} 1\n\n")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//#define ${flag} 1\n\n")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
file(GLOB all_config_tests "${CGAL_MODULES_DIR}/config/testfiles/*.cpp")
|
||||
list(SORT all_config_tests)
|
||||
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n")
|
||||
|
||||
foreach(config_test_cpp ${all_config_tests})
|
||||
# Test's name is .cpp's base name
|
||||
get_filename_component(config_test_name ${config_test_cpp} NAME_WE)
|
||||
|
||||
# Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}.
|
||||
CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name})
|
||||
if(${config_test_name})
|
||||
set(${config_test_name} 0)
|
||||
else()
|
||||
set(${config_test_name} 1)
|
||||
endif()
|
||||
|
||||
add_config_flag(${config_test_name} ${config_test_name})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_config_flag(CGAL_USE_GMP)
|
||||
add_config_flag(CGAL_USE_MPFR)
|
||||
add_config_flag(CGAL_USE_GMPXX)
|
||||
add_config_flag(CGAL_USE_LEDA)
|
||||
add_config_flag(CGAL_USE_MPFI)
|
||||
add_config_flag(CGAL_USE_RS)
|
||||
add_config_flag(CGAL_USE_NTL)
|
||||
|
||||
add_config_flag( CGAL_BUILD_SHARED_LIBS )
|
||||
|
||||
if (NOT ${WITH_CGAL_Core})
|
||||
set(CGAL_USE_CORE FALSE)
|
||||
else()
|
||||
set(CGAL_USE_CORE ${CGAL_USE_GMP})
|
||||
endif()
|
||||
add_config_flag( CGAL_USE_CORE )
|
||||
# ^^ there is CGAL_USE_CORE and not CGAL_HAS_CORE, as CORE is considered
|
||||
# as external lib and not as CGAL component (EBEB: 24 Jan 2012)
|
||||
|
||||
if ( RUNNING_CGAL_AUTO_TEST AND MSVC )
|
||||
file( APPEND "${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h" "#include <CGAL/Testsuite/vc_debug_hook.h>\n\n" )
|
||||
endif()
|
||||
|
||||
message("== Write compiler_config.h (DONE) ==\n")
|
||||
|
||||
endif(NOT CGAL_HEADER_ONLY)
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# -= Installation Setup =-
|
||||
|
|
@ -753,8 +678,7 @@ cache_get(CGAL_3RD_PARTY_LIBRARIES_DIRS)
|
|||
add_subdirectory(src)
|
||||
|
||||
#
|
||||
# Variables used when WITH_{demos|examples|tests} are TRUE, and
|
||||
# CGAL_HEADER_ONLY=ON
|
||||
# Variables used when WITH_{demos|examples|tests} are TRUE
|
||||
#
|
||||
set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake)
|
||||
get_property(CGAL_FOUND GLOBAL PROPERTY CGAL_FOUND)
|
||||
|
|
@ -807,14 +731,10 @@ if (CGAL_BRANCH_BUILD AND CGAL_REPORT_DUPLICATE_FILES )
|
|||
|
||||
endif()
|
||||
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
create_CGALconfig_files()
|
||||
else()
|
||||
configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY)
|
||||
configure_file("${CGAL_MODULES_DIR}/CGALConfigVersion_binary_header_only.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake" @ONLY)
|
||||
endif()
|
||||
configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY)
|
||||
configure_file("${CGAL_MODULES_DIR}/CGALConfigVersion_binary_header_only.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake" @ONLY)
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
#
|
||||
|
|
@ -861,24 +781,17 @@ if ( ZLIB_IN_AUXILIARY )
|
|||
endif()
|
||||
|
||||
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfigBuildVersion.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfigVersion.cmake
|
||||
DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
|
||||
if(NOT CGAL_INSTALL_CMAKE_DIR STREQUAL "${CGAL_INSTALL_LIB_DIR}/cmake/CGAL")
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig-installation-dirs.cmake.in
|
||||
${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake)
|
||||
install(FILES
|
||||
${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake
|
||||
${CMAKE_BINARY_DIR}/config/CGALConfig.cmake
|
||||
DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
|
||||
else()
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfigBuildVersion.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfigVersion.cmake
|
||||
${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake
|
||||
DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
|
||||
if(NOT CGAL_INSTALL_CMAKE_DIR STREQUAL "${CGAL_INSTALL_LIB_DIR}/cmake/CGAL")
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig-installation-dirs.cmake.in
|
||||
${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake)
|
||||
install(FILES
|
||||
${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake
|
||||
DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CGAL_INSTALL_MAN_DIR)
|
||||
|
|
|
|||
|
|
@ -2,24 +2,6 @@ if(CGAL_Qt5_moc_and_resource_files_included)
|
|||
return()
|
||||
endif()
|
||||
set(CGAL_Qt5_moc_and_resource_files_included TRUE)
|
||||
|
||||
if(NOT CGAL_HEADER_ONLY AND CGAL_BUILDING_LIBS)
|
||||
qt5_wrap_cpp(_CGAL_Qt5_MOC_FILES_private
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/DemosMainWindow.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewInput.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/camera.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/frame.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/keyFrameInterpolator.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/manipulatedCameraFrame.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/manipulatedFrame.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/qglviewer.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/image_interface.h
|
||||
TARGET CGAL_Qt5
|
||||
)
|
||||
endif()#CGAL_HEADER_ONLY
|
||||
|
||||
# qrc files (resources files, that contain icons, at least)
|
||||
if(EXISTS ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/CGAL.qrc)
|
||||
qt5_add_resources (_CGAL_Qt5_RESOURCE_FILES_private
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@
|
|||
# If set, the `LEDA` library will be searched and used to provide
|
||||
# the exact number types used by CGAL kernels.
|
||||
#
|
||||
# .. variable:: CGAL_HEADER_ONLY
|
||||
#
|
||||
# Set this variable if you are using the CGAL libraries as
|
||||
# header-only libraries.
|
||||
#
|
||||
if(CGAL_SetupCGALDependencies_included)
|
||||
return()
|
||||
endif()
|
||||
|
|
@ -95,10 +90,6 @@ function(CGAL_setup_CGAL_dependencies target)
|
|||
if(WITH_LEDA)
|
||||
use_CGAL_LEDA_support(${target} ${keyword})
|
||||
endif()
|
||||
|
||||
if (NOT CGAL_HEADER_ONLY)
|
||||
target_compile_definitions(${target} ${keyword} CGAL_NOT_HEADER_ONLY=1)
|
||||
endif()
|
||||
if (RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE)
|
||||
target_compile_definitions(${target} ${keyword} CGAL_TEST_SUITE=1)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ if(NOT CGAL_Qt5_MISSING_DEPS)
|
|||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Qt5_moc_and_resource_files.cmake)
|
||||
|
||||
if(CGAL_HEADER_ONLY AND (WITH_demos OR WITH_examples OR WITH_tests OR NOT CGAL_BUILDING_LIBS) AND NOT TARGET CGAL_Qt5_moc_and_resources)
|
||||
add_library(CGAL_Qt5_moc_and_resources STATIC
|
||||
${_CGAL_Qt5_MOC_FILES_private}
|
||||
if((WITH_demos OR WITH_examples OR WITH_tests OR NOT CGAL_BUILDING_LIBS) AND NOT TARGET CGAL_Qt5_moc_and_resources)
|
||||
add_library(CGAL_Qt5_moc_and_resources STATIC
|
||||
${_CGAL_Qt5_MOC_FILES_private}
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/DemosMainWindow.h
|
||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h
|
||||
|
|
@ -116,9 +116,7 @@ function(CGAL_setup_CGAL_Qt5_dependencies target)
|
|||
target_compile_definitions( ${target} ${keyword} CGAL_FAKE_PUBLIC_RELEASE=1 )
|
||||
endif()
|
||||
target_link_libraries( ${target} ${keyword} CGAL::CGAL)
|
||||
if(CGAL_HEADER_ONLY)
|
||||
target_link_libraries( ${target} ${keyword} CGAL::Qt5_moc_and_resources)
|
||||
endif()
|
||||
target_link_libraries( ${target} ${keyword} CGAL::Qt5_moc_and_resources)
|
||||
target_link_libraries( ${target} ${keyword} Qt5::OpenGL Qt5::Svg Qt5::Xml)
|
||||
|
||||
# Remove -Wdeprecated-copy, for g++ >= 9.0, because Qt5, as of
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ if(NOT USE_CGAL_FILE_INCLUDED)
|
|||
use_component( ${component} )
|
||||
endforeach()
|
||||
|
||||
use_essential_libs()
|
||||
|
||||
include_directories( "${CMAKE_CURRENT_BINARY_DIR}" )
|
||||
|
||||
|
|
@ -46,16 +45,8 @@ if(NOT USE_CGAL_FILE_INCLUDED)
|
|||
include_directories ( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
|
||||
add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_DEFINITIONS} )
|
||||
|
||||
if (CGAL_HEADER_ONLY)
|
||||
if(NOT CGAL_NO_BLANKET_LINKING)
|
||||
link_directories ( ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
|
||||
link_libraries ( ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
|
||||
endif()
|
||||
else()
|
||||
if(NOT CGAL_NO_BLANKET_LINKING)
|
||||
link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
|
||||
link_libraries ( ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
|
||||
endif()
|
||||
if(NOT CGAL_NO_BLANKET_LINKING)
|
||||
link_directories ( ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
|
||||
link_libraries ( ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ set(CGAL_LIBRARIES CGAL)
|
|||
|
||||
get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
set(CGAL_HEADER_ONLY TRUE)
|
||||
|
||||
function(cgal_detect_branch_build VAR_NAME)
|
||||
if(IS_DIRECTORY ${CGAL_CONFIG_DIR}/../../../../Installation/package_info/Installation/)
|
||||
set(${VAR_NAME} TRUE PARENT_SCOPE)
|
||||
|
|
|
|||
|
|
@ -4,16 +4,10 @@ collect_cgal_library(CGAL "")
|
|||
|
||||
include(CGAL_SetupCGALDependencies)
|
||||
|
||||
if(CGAL_HEADER_ONLY)
|
||||
set(keyword "INTERFACE")
|
||||
endif()
|
||||
set(keyword "INTERFACE")
|
||||
|
||||
CGAL_setup_CGAL_dependencies(CGAL ${keyword})
|
||||
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
target_compile_definitions(CGAL INTERFACE CGAL_NOT_HEADER_ONLY=1)
|
||||
endif()
|
||||
|
||||
if(NOT CGAL_DISABLE_GMP)
|
||||
get_dependency_version(GMP)
|
||||
get_dependency_version(MPFR)
|
||||
|
|
|
|||
|
|
@ -1,33 +1,4 @@
|
|||
function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
|
||||
|
||||
if (NOT CGAL_HEADER_ONLY)
|
||||
# IMPORTANT: First delete all_files.cpp
|
||||
if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp)
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp)
|
||||
endif()
|
||||
|
||||
# THEN collect *.cpp
|
||||
foreach (package ${CGAL_CONFIGURED_PACKAGES} )
|
||||
file(GLOB CGAL_LIBRARY_SOURCE_FILES_TMP ${package}/src/${LIBRARY_NAME}/*.cpp)
|
||||
list(SORT CGAL_LIBRARY_SOURCE_FILES_TMP)
|
||||
foreach(file ${CGAL_LIBRARY_SOURCE_FILES_TMP})
|
||||
if(NOT ${file} MATCHES "/qrc_.*")
|
||||
list(APPEND CGAL_LIBRARY_SOURCE_FILES ${file})
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
foreach(source ${CGAL_LIBRARY_SOURCE_FILES})
|
||||
# It may happen that a file all_files.cpp had been created in-source by
|
||||
# a previous in-source build. We certainly do not want to include that
|
||||
# file in the new all_files.cpp because .cpp files would be included
|
||||
# twice, and that breaks the one-definition rule (ODR).
|
||||
if(NOT source MATCHES ".*/all_files.cpp")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CGAL_BUILD_SHARED_LIBS)
|
||||
set(CGAL_LIB_PREFIX "")
|
||||
else()
|
||||
|
|
@ -44,29 +15,7 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
|
|||
set(rc_file )
|
||||
endif()
|
||||
|
||||
if (NOT CGAL_HEADER_ONLY)
|
||||
add_library (${LIBRARY_NAME}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp
|
||||
${rc_file}
|
||||
${ADDITIONAL_FILES})
|
||||
# add_library (${LIBRARY_NAME} ${CGAL_LIBRARY_SOURCE_FILES} ${rc_file} ${ADDITIONAL_FILES}) # builing not creating temporary all_files.cpp
|
||||
if(${LIBRARY_NAME}_SOVERSION AND ${LIBRARY_NAME}_SONAME_VERSION)
|
||||
set_target_properties(${LIBRARY_NAME} PROPERTIES
|
||||
VERSION "${${LIBRARY_NAME}_SOVERSION}"
|
||||
SOVERSION "${${LIBRARY_NAME}_SONAME_VERSION}")
|
||||
elseif(CGAL_SOVERSION AND CGAL_SONAME_VERSION)
|
||||
set_target_properties(${LIBRARY_NAME} PROPERTIES
|
||||
VERSION "${CGAL_SOVERSION}"
|
||||
SOVERSION "${CGAL_SONAME_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
if(${LIBRARY_NAME}_LIB_DEPENDS)
|
||||
# Fix a bug when CGAL is configured first without `CGAL_HEADER_ONLY`
|
||||
# and then `CGAL_HEADER_ONLY` is set without cleaning the cache.
|
||||
unset(${LIBRARY_NAME}_LIB_DEPENDS CACHE)
|
||||
endif()
|
||||
add_library(${LIBRARY_NAME} INTERFACE)
|
||||
endif()
|
||||
add_library(${LIBRARY_NAME} INTERFACE)
|
||||
|
||||
# Add an alias with the prefix `CGAL::`, so that consumer
|
||||
# CMakeLists.txt can be the target like if it was an imported
|
||||
|
|
@ -76,39 +25,7 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
|
|||
add_custom_target( ALL_CGAL_TARGETS )
|
||||
endif()
|
||||
add_dependencies( ALL_CGAL_TARGETS ${LIBRARY_NAME} )
|
||||
if(CGAL_AUTO_LINK_ENABLED)
|
||||
if (NOT CGAL_HEADER_ONLY)
|
||||
set_target_properties( ${LIBRARY_NAME} PROPERTIES
|
||||
OUTPUT_NAME_DEBUG "${DEBUG_MANGLED_NAME}"
|
||||
OUTPUT_NAME_RELEASE "${RELEASE_MANGLED_NAME}"
|
||||
OUTPUT_NAME_MINSIZEREL "${RELEASE_MANGLED_NAME}"
|
||||
OUTPUT_NAME_RELWITHDEBINFO "${RELEASE_MANGLED_NAME}"
|
||||
)
|
||||
|
||||
if ( HAS_CFG_INTDIR )
|
||||
add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(TargetDir)$(TargetName).dll\" copy /Y \"$(TargetDir)$(TargetName).dll\" \"$(TargetDir)..\" )
|
||||
add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(TargetDir)$(TargetName).pdb\" copy /Y \"$(TargetDir)$(TargetName).pdb\" \"$(TargetDir)..\" )
|
||||
add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(SolutionDir)lib\\$(ConfigurationName)\\$(TargetName).lib\" copy /Y \"$(SolutionDir)lib\\$(ConfigurationName)\\$(TargetName).lib\" \"$(SolutionDir)lib\" )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT CGAL_HEADER_ONLY)
|
||||
install(TARGETS ${LIBRARY_NAME} EXPORT ${LIBRARY_NAME}Exports
|
||||
RUNTIME DESTINATION "${CGAL_INSTALL_BIN_DIR}"
|
||||
LIBRARY DESTINATION "${CGAL_INSTALL_LIB_DIR}"
|
||||
ARCHIVE DESTINATION "${CGAL_INSTALL_LIB_DIR}")
|
||||
install(EXPORT ${LIBRARY_NAME}Exports
|
||||
DESTINATION "${CGAL_INSTALL_CMAKE_DIR}"
|
||||
NAMESPACE CGAL::)
|
||||
|
||||
# We have to call configure_file twice to force double expansion of variables.
|
||||
configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
|
||||
configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function( configure_component DIR COMPONENT )
|
||||
|
|
@ -142,9 +59,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CGAL_RUNTIME_DIR})
|
|||
|
||||
# TODO: Seems useless, because it is called again in ../CMakeLists.txt
|
||||
# Should probably be removed. -- Laurent Rineau, 2014/07/22
|
||||
if(NOT CGAL_HEADER_ONLY)
|
||||
create_CGALconfig_files()
|
||||
endif()
|
||||
|
||||
set(CGAL_DIR ${CMAKE_BINARY_DIR})
|
||||
|
||||
|
|
@ -224,9 +138,5 @@ CGAL_add_if_target(CGAL_Qt5)
|
|||
|
||||
cache_set(CGAL_ACTUAL_CONFIGURED_LIBRARIES "${CGAL_ACTUAL_CONFIGURED_LIBRARIES}")
|
||||
|
||||
if (NOT CGAL_HEADER_ONLY)
|
||||
export(TARGETS ${CGAL_ACTUAL_CONFIGURED_LIBRARIES} NAMESPACE CGAL:: FILE "${CMAKE_BINARY_DIR}/CGALExports.cmake")
|
||||
endif()
|
||||
|
||||
message(STATUS "Sources for CGAL component libraries '${CGAL_CONFIGURED_LIBRARIES}' detected")
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ SET(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /GR /EHsc -D_CRT_SECURE_NO_DEPRECATE
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1" CACHE STRING "")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MD /O2 /Ob2 /DCGAL_NDEBUG" CACHE STRING "")
|
||||
|
||||
|
||||
SET(TBBROOT "C:/3rdPartyLibs/tbb2018_20170919oss" CACHE STRING "")
|
||||
|
||||
SET(WITH_GMP ON CACHE BOOL "")
|
||||
|
|
@ -20,8 +20,6 @@ SET(WITH_NTL OFF CACHE BOOL "")
|
|||
|
||||
SET(WITH_demos ON CACHE BOOL "")
|
||||
|
||||
SET(CGAL_HEADER_ONLY ON CACHE BOOL "")
|
||||
|
||||
SET(Boost_DIR "C:\\3rdPartyLibs\\boost_master\\install_dir\\lib\\cmake\\Boost-1.71.0" CACHE PATH "")
|
||||
|
||||
SET(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "")
|
||||
SET(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "")
|
||||
|
|
|
|||
|
|
@ -21,5 +21,3 @@ SET(WITH_MPFR ON CACHE BOOL "")
|
|||
SET(WITH_NTL OFF CACHE BOOL "")
|
||||
|
||||
SET(WITH_demos ON CACHE BOOL "")
|
||||
|
||||
SET(CGAL_HEADER_ONLY ON CACHE BOOL "")
|
||||
|
|
|
|||
|
|
@ -209,9 +209,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
|||
# CMake). That is to deal with the visibility of symbols of
|
||||
# `Three.h`/`Three.cpp`.
|
||||
target_compile_definitions(demo_framework PRIVATE three_EXPORTS=1)
|
||||
if(CGAL_HEADER_ONLY)
|
||||
target_compile_definitions(demo_framework PRIVATE -DCGAL_USE_Qt5_RESOURCES)
|
||||
endif()
|
||||
target_compile_definitions(demo_framework PRIVATE -DCGAL_USE_Qt5_RESOURCES)
|
||||
|
||||
add_library(scene_basic_objects SHARED
|
||||
Scene_plane_item.cpp
|
||||
|
|
|
|||
Loading…
Reference in New Issue