Merge pull request #6950 from lrineau/CGAL-allow_Epick_with_float-GF

Simple_precision_epick: an Epick-like kernel with float as FT
This commit is contained in:
Laurent Rineau 2023-05-04 16:37:17 +02:00
commit d2bc415a15
56 changed files with 783 additions and 151 deletions

View File

@ -0,0 +1,466 @@
// Copyright (c) 2022 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Laurent Rineau
#ifndef CGAL_CARTESIAN_IS_TRIVIAL_CONSTRUCTION_H
#define CGAL_CARTESIAN_IS_TRIVIAL_CONSTRUCTION_H
#include <CGAL/type_traits/is_iterator.h>
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/tags.h>
#include <CGAL/enum.h>
#include <CGAL/type_traits.h>
namespace CGAL {
namespace CartesianFunctors {
template <class Construction, typename ...Args>
struct Is_trivial_construction_base
{
// If the return type of the construction, with the specified arguments, is a
// reference or an iterator, them the construction is necessarily trivial.
using return_type = decltype(std::declval<Construction>()(std::declval<Args>()...));
enum {
value = std::is_reference<return_type>::value || CGAL::is_iterator<return_type>::value
};
};
template <class Construction, typename ...Args>
struct Is_trivial_construction : public Is_trivial_construction_base<Construction, Args...>
{};
template <typename K, typename... Args>
struct Is_trivial_construction<CommonKernelFunctors::Assign_2<K>, Args...>
: public Tag_true
{};
template <typename K, typename... Args>
struct Is_trivial_construction<CommonKernelFunctors::Assign_3<K>, Args...>
: public Tag_true
{};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_point_2<K>, Args...>
{
typedef typename K::RT RT;
static Tag_true trivial(Return_base_tag, Origin);
static Tag_true trivial(Return_base_tag, RT, RT);
static Tag_true trivial(Origin);
static Tag_true trivial(RT, RT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_point_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_point_3<K>, Args...>
{
typedef typename K::RT RT;
static Tag_true trivial(Return_base_tag, Origin);
static Tag_true trivial(Return_base_tag, RT, RT, RT);
static Tag_true trivial(Origin);
static Tag_true trivial(RT, RT, RT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_point_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_weighted_point_2<K>, Args...>
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
static Tag_true trivial(Return_base_tag, Origin);
static Tag_true trivial(Return_base_tag, Point_2, FT);
static Tag_true trivial(Return_base_tag, FT, FT);
static Tag_true trivial(Point_2, FT);
static Tag_true trivial(Origin);
static Tag_true trivial(FT, FT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_weighted_point_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_weighted_point_3<K>, Args...>
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
static Tag_true trivial(Return_base_tag, Origin);
static Tag_true trivial(Return_base_tag, Point_3, FT);
static Tag_true trivial(Return_base_tag, FT, FT, FT);
static Tag_true trivial(Point_3, FT);
static Tag_true trivial(Origin);
static Tag_true trivial(FT, FT, FT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_weighted_point_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_vector_2<K>, Args...>
{
typedef typename K::RT RT;
typedef typename K::Point_2 Point_2;
static Tag_true trivial(Return_base_tag, Null_vector);
static Tag_true trivial(Return_base_tag, Origin, Point_2);
static Tag_true trivial(Return_base_tag, RT, RT);
static Tag_true trivial(Null_vector);
static Tag_true trivial(Origin, Point_2);
static Tag_true trivial(RT, RT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_vector_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_vector_3<K>, Args...>
{
typedef typename K::RT RT;
typedef typename K::Point_3 Point;
typedef typename K::Line_3 Line;
static Tag_true trivial(Return_base_tag, Null_vector);
static Tag_true trivial(Return_base_tag, Origin, Point);
static Tag_true trivial(Return_base_tag, RT, RT, RT);
static Tag_true trivial(Return_base_tag, Line);
static Tag_true trivial(Null_vector);
static Tag_true trivial(Origin, Point);
static Tag_true trivial(RT, RT, RT);
static Tag_true trivial(Line);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_vector_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_direction_2<K>, Args...>
{
typedef typename K::RT RT;
typedef typename K::Vector_2 Vector;
static Tag_true trivial(Return_base_tag, RT, RT);
static Tag_true trivial(Return_base_tag, Vector);
static Tag_true trivial(RT, RT);
static Tag_true trivial(Vector);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_direction_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_direction_3<K>, Args...>
{
typedef typename K::RT RT;
typedef typename K::Vector_3 Vector;
static Tag_true trivial(Return_base_tag, RT, RT, RT);
static Tag_true trivial(Return_base_tag, Vector);
static Tag_true trivial(RT, RT, RT);
static Tag_true trivial(Vector);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_direction_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_line_2<K>, Args...>
{
typedef typename K::RT RT;
static Tag_true trivial(Return_base_tag, RT, RT, RT);
static Tag_true trivial(RT, RT, RT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_line_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_line_3<K>, Args...>
{
typedef typename K::Point_3 Point;
typedef typename K::Vector_3 Vector;
typedef typename K::Direction_3 Direction;
static Tag_true trivial(Return_base_tag, Point, Vector);
static Tag_true trivial(Return_base_tag, Point, Direction);
static Tag_true trivial(Point, Vector);
static Tag_true trivial(Point, Direction);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_line_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_segment_2<K>, Args...>
{
typedef typename K::Point_2 Point;
static Tag_true trivial(Return_base_tag, Point, Point);
static Tag_true trivial(Point, Point);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CommonKernelFunctors::Construct_segment_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_segment_3<K>, Args...>
{
typedef typename K::Point_3 Point;
static Tag_true trivial(Return_base_tag, Point, Point);
static Tag_true trivial(Point, Point);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CommonKernelFunctors::Construct_segment_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_circle_2<K>, Args...>
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point;
static Tag_true trivial(Return_base_tag, Point, FT, Orientation);
static Tag_true trivial(Return_base_tag, Point, Orientation);
static Tag_true trivial(Point, FT, Orientation);
static Tag_true trivial(Point, Orientation);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_circle_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Compute_squared_radius_2<K>, Args...>
{
typedef typename K::Point_2 Point_2;
typedef typename K::Circle_2 Circle_2;
static Tag_true trivial(Point_2);
static Tag_true trivial(Circle_2);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Compute_squared_radius_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Compute_squared_radius_3<K>, Args...>
{
typedef typename K::Point_3 Point_3;
typedef typename K::Circle_3 Circle_3;
typedef typename K::Sphere_3 Sphere_3;
static Tag_true trivial(Point_3);
static Tag_true trivial(Circle_3);
static Tag_true trivial(Sphere_3);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Compute_squared_radius_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_iso_rectangle_2<K>, Args...>
{
typedef typename K::Point_2 Point;
typedef typename K::RT RT;
static Tag_true trivial(Return_base_tag, Point, Point);
static Tag_true trivial(Return_base_tag, Point, Point, int);
static Tag_true trivial(Return_base_tag, Point, Point, Point, Point);
static Tag_true trivial(Return_base_tag, RT, RT, RT, RT);
static Tag_true trivial(Point, Point);
static Tag_true trivial(Point, Point, int);
static Tag_true trivial(Point, Point, Point, Point);
static Tag_true trivial(RT, RT, RT, RT);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_iso_rectangle_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CartesianKernelFunctors::Construct_iso_cuboid_3<K>, Args...>
{
typedef typename K::Point_3 Point;
typedef typename K::RT RT;
static Tag_true trivial(Return_base_tag, Point, Point);
static Tag_true trivial(Return_base_tag, Point, Point, int);
static Tag_true trivial(Return_base_tag, Point, Point, Point, Point, Point, Point);
static Tag_true trivial(Return_base_tag, RT, RT, RT, RT, RT, RT);
static Tag_true trivial(Point, Point);
static Tag_true trivial(Point, Point, int);
static Tag_true trivial(Point, Point, Point, Point, Point, Point);
static Tag_true trivial(RT, RT, RT, RT, RT, RT);
\
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_iso_cuboid_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_ray_2<K>, Args...>
{
typedef typename K::Point_2 Point;
static Tag_true trivial(Return_base_tag, Point, Point);
static Tag_true trivial(Point, Point);
\
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CommonKernelFunctors::Construct_ray_2<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_ray_3<K>, Args...>
{
typedef typename K::Point_3 Point;
static Tag_true trivial(Return_base_tag, Point, Point);
static Tag_true trivial(Point, Point);
\
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CommonKernelFunctors::Construct_ray_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_triangle_2<K>, Args...> : public Tag_true
{};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_triangle_3<K>, Args...> : public Tag_true
{};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_plane_3<K>, Args...>
{
typedef typename K::RT RT;
typedef typename K::Circle_3 Circle;
static Tag_true trivial(Return_base_tag, RT, RT, RT, RT);
static Tag_true trivial(Return_base_tag, Circle);
static Tag_true trivial(RT, RT, RT, RT);
static Tag_true trivial(Circle);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CommonKernelFunctors::Construct_plane_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_sphere_3<K>, Args...>
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Circle_3 Circle_3;
static Tag_true trivial(Return_base_tag, Point_3, FT, Orientation);
static Tag_true trivial(Return_base_tag, Point_3, Orientation);
static Tag_true trivial(Return_base_tag, Circle_3);
static Tag_true trivial(Point_3, FT, Orientation);
static Tag_true trivial(Point_3, Orientation);
static Tag_true trivial(Circle_3);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_sphere_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_circle_3<K>, Args...>
{
typedef typename K::Plane_3 Plane_3;
typedef typename K::Sphere_3 Sphere_3;
static Tag_true trivial(Return_base_tag, Plane_3, Sphere_3, int);
static Tag_true trivial(Plane_3, Sphere_3, int);
static Tag_true trivial(Sphere_3, Plane_3, int);
static Tag_false trivial(...);
enum { value = decltype(trivial(std::declval<CGAL::cpp20::remove_cvref_t<Args>>()...))::value ||
Is_trivial_construction_base<CGAL::CartesianKernelFunctors::Construct_circle_3<K>, Args...>::value
};
};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_second_point_3<K>, Args...> : public Tag_true
{};
template <typename K, typename... Args>
struct Is_trivial_construction<CGAL::CommonKernelFunctors::Construct_tetrahedron_3<K>, Args...> : public Tag_true
{};
} // end namespace CartesianFunctors
} // end namespace CGAL
#endif // CGAL_CARTESIAN_IS_TRIVIAL_CONSTRUCTION_H

View File

@ -30,6 +30,7 @@
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
#include <CGAL/Origin.h> #include <CGAL/Origin.h>
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Kernel/Type_mapper.h> #include <CGAL/Kernel/Type_mapper.h>
#include <vector> #include <vector>
#include <boost/mpl/lambda.hpp> #include <boost/mpl/lambda.hpp>
@ -108,6 +109,12 @@ public:
return n; return n;
} }
Return_base_tag
operator()(Return_base_tag o) const
{
return o;
}
const Bbox_2& const Bbox_2&
operator()(const Bbox_2& b) const operator()(const Bbox_2& b) const
{ {

View File

@ -0,0 +1,64 @@
// Copyright (c) 2022 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Laurent Rineau
#ifndef CGAL_CONVERTING_CONSTRUCTION_H
#define CGAL_CONVERTING_CONSTRUCTION_H
#include <CGAL/config.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/Cartesian/Is_trivial_construction.h>
#include <type_traits>
namespace CGAL {
template <class Source_construction, class Target_construction,
class Converter, class Backward_converter>
struct Converting_construction
{
CGAL_NO_UNIQUE_ADDRESS Source_construction source_construction;
CGAL_NO_UNIQUE_ADDRESS Target_construction construct;
CGAL_NO_UNIQUE_ADDRESS Converter convert;
CGAL_NO_UNIQUE_ADDRESS Backward_converter backward_convert;
template <typename... Args,
std::enable_if_t<CartesianFunctors::Is_trivial_construction<Source_construction, Args...>::value>* = nullptr>
decltype(auto) operator()(Args&&... args) const {
return source_construction(std::forward<Args>(args)...);
}
template <typename... Args,
std::enable_if_t<!CartesianFunctors::Is_trivial_construction<Source_construction, Args...>::value>* = nullptr>
auto operator()(Args&&... args) const {
return backward_convert(construct(convert(args)...));
}
};
template <class Kernel_A, class Kernel_B>
struct Converting_constructions_kernel_adaptor : public Kernel_A
{
using A_to_B = Cartesian_converter<Kernel_A, Kernel_B>;
using B_to_A = Cartesian_converter<Kernel_B, Kernel_A>;
#define CGAL_Kernel_cons(C,Cf) \
using C = Converting_construction<typename Kernel_A::C, \
typename Kernel_B::C, \
A_to_B, \
B_to_A>; \
C Cf() const { return C(); }
#include <CGAL/Kernel/interface_macros.h>
};
} // end namespace CGAL
#endif // CGAL_CONVERTING_CONSTRUCTION_H

View File

@ -346,7 +346,10 @@ using std::max;
#define CGAL_NORETURN [[noreturn]] #define CGAL_NORETURN [[noreturn]]
// Macro to specify [[no_unique_address]] if supported // Macro to specify [[no_unique_address]] if supported
#if __has_cpp_attribute(no_unique_address) #if _MSC_VER >= 1929 && _MSVC_LANG >= 202002L
// see https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#c20-no_unique_address
# define CGAL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
#elif __has_cpp_attribute(no_unique_address)
# define CGAL_NO_UNIQUE_ADDRESS [[no_unique_address]] # define CGAL_NO_UNIQUE_ADDRESS [[no_unique_address]]
#else #else
# define CGAL_NO_UNIQUE_ADDRESS # define CGAL_NO_UNIQUE_ADDRESS

View File

@ -5944,6 +5944,11 @@ public:
Kernel::Point_3 operator()(const Kernel::Line_3& l, Kernel::Point_3 operator()(const Kernel::Line_3& l,
const Kernel::FT i); const Kernel::FT i);
/*!
returns `point(0)` on `l`, identical to `operator()(l,0)`.
*/
Kernel::Point_3 operator()(const Kernel::Line_3& l);
/*! /*!
returns an arbitrary point on `h`. returns an arbitrary point on `h`.
*/ */

View File

@ -19,28 +19,67 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h> #include <CGAL/Filtered_kernel.h>
#include <CGAL/Converting_construction.h>
#include <CGAL/Triangulation_structural_filtering_traits.h> #include <CGAL/Triangulation_structural_filtering_traits.h>
#include <CGAL/double.h>
#include <CGAL/float.h>
namespace CGAL { namespace CGAL {
constexpr bool epick_use_static_filter =
#ifdef CGAL_NO_STATIC_FILTERS
false;
#else
true;
#endif
// Here Epick is a class, and Double_precision_epick an alias to it.
class Epick;
class Single_precision_epick;
using Double_precision_epick = Epick;
namespace internal {
// Basic objects, constructions, and predicates, using the same base class as
// Simple_cartesian<NT>: Cartesian_base without reference counting.
template <typename NT, typename Kernel>
using Epick_base =
typename Simple_cartesian<NT>::template Base<Kernel>::Type;
// Add the type equality property, by changing the objects types
template <typename NT, typename Kernel>
using Epick_base_with_type_equality =
Type_equality_wrapper<Epick_base<NT, Kernel>, Kernel>;
// Change the predicates to filtered predicates (with static filters or not)
template <typename NT, typename Kernel>
using Epick_with_filtered_predicates =
Filtered_kernel_adaptor<Epick_base_with_type_equality<NT, Kernel>, epick_use_static_filter>;
};
// The following is equivalent to Filtered_kernel< Simple_cartesian<double> >, // The following is equivalent to Filtered_kernel< Simple_cartesian<double> >,
// but it's shorter in terms of template name length (for error messages, mangling...). // but it's shorter in terms of template name length (for error messages, mangling...).
class Epick : public internal::Epick_with_filtered_predicates<double, Epick>
class Epick
: public Filtered_kernel_adaptor<
Type_equality_wrapper< Simple_cartesian<double>::Base<Epick>::Type, Epick >,
#ifdef CGAL_NO_STATIC_FILTERS
false >
#else
true >
#endif
{}; {};
typedef Epick Exact_predicates_inexact_constructions_kernel; template <>
struct Triangulation_structural_filtering_traits<Double_precision_epick> {
using Use_structural_filtering_tag = Tag_true;
};
using Exact_predicates_inexact_constructions_kernel = Epick;
// This kernel is Epick with the difference that its `FT` is `float`.
class Single_precision_epick
: public Converting_constructions_kernel_adaptor<
internal::Epick_with_filtered_predicates<float, Single_precision_epick>,
Double_precision_epick>
{};
template <> template <>
struct Triangulation_structural_filtering_traits<Epick> { struct Triangulation_structural_filtering_traits<Single_precision_epick> {
typedef Tag_true Use_structural_filtering_tag; using Use_structural_filtering_tag = Tag_true;
}; };
} //namespace CGAL } //namespace CGAL

View File

@ -1090,7 +1090,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Line_2& l) const operator()(const Line_2& l) const
{ {
return l.rep().a(); return l.rep().a();
@ -1106,7 +1106,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Plane_3& l) const operator()(const Plane_3& l) const
{ {
return l.rep().a(); return l.rep().a();
@ -1123,7 +1123,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Line_2& l) const operator()(const Line_2& l) const
{ {
return l.rep().b(); return l.rep().b();
@ -1139,7 +1139,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Plane_3& l) const operator()(const Plane_3& l) const
{ {
return l.rep().b(); return l.rep().b();
@ -1156,7 +1156,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Line_2& l) const operator()(const Line_2& l) const
{ {
return l.rep().c(); return l.rep().c();
@ -1172,7 +1172,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Plane_3& l) const operator()(const Plane_3& l) const
{ {
return l.rep().c(); return l.rep().c();
@ -1188,7 +1188,7 @@ namespace CommonKernelFunctors {
public: public:
typedef RT result_type; typedef RT result_type;
RT const RT&
operator()(const Plane_3& l) const operator()(const Plane_3& l) const
{ {
return l.rep().d(); return l.rep().d();
@ -2228,6 +2228,10 @@ namespace CommonKernelFunctors {
public: public:
typedef Point_3 result_type; typedef Point_3 result_type;
const Point_3&
operator()( const Line_3& l) const
{ return l.rep().point(); }
Point_3 Point_3
operator()( const Line_3& l, const FT i) const operator()( const Line_3& l, const FT i) const
{ return l.rep().point(i); } { return l.rep().point(i); }

View File

@ -89,18 +89,17 @@ public:
: RLine_2(typename R::Construct_line_2()(Return_base_tag(), p,v)) {} : RLine_2(typename R::Construct_line_2()(Return_base_tag(), p,v)) {}
// FIXME : Use Qrt<> here. decltype(auto) a() const
RT a() const
{ {
return R().compute_a_2_object()(*this); return R().compute_a_2_object()(*this);
} }
RT b() const decltype(auto) b() const
{ {
return R().compute_b_2_object()(*this); return R().compute_b_2_object()(*this);
} }
RT c() const decltype(auto) c() const
{ {
return R().compute_c_2_object()(*this); return R().compute_c_2_object()(*this);
} }

View File

@ -106,7 +106,7 @@ public:
Point_3 point() const Point_3 point() const
{ {
return R().construct_point_on_3_object()(*this, 0); return R().construct_point_on_3_object()(*this);
} }
Point_3 point(const FT i) const Point_3 point(const FT i) const

View File

@ -106,7 +106,7 @@ public:
return R().construct_bbox_3_object()(*this); return R().construct_bbox_3_object()(*this);
} }
FT squared_area() const // TODO : use Qrt decltype(auto) squared_area() const
{ {
return R().compute_squared_area_3_object()(*this); return R().compute_squared_area_3_object()(*this);
} }

View File

@ -74,8 +74,18 @@ main()
std::cout << "Testing with Epeck:\n"; std::cout << "Testing with Epeck:\n";
test<Cls>(); test<Cls>();
std::cout << "Testing with Epick:\n"; std::cout << "Testing with Double_precision_epick:\n";
test<CGAL::Epick>(); test<CGAL::Double_precision_epick>();
# if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable: 4244)
# endif
std::cout << "Testing with Simple_precision_epick:\n";
test<CGAL::Single_precision_epick>();
# if defined(BOOST_MSVC)
# pragma warning(pop)
# endif
return 0; return 0;
} }

View File

@ -12,6 +12,10 @@ bool approx_equal(double a, double b) {
return std::abs(boost::math::float_distance(a, b)) <= 1; return std::abs(boost::math::float_distance(a, b)) <= 1;
} }
bool approx_equal(float a, float b) {
return std::abs(boost::math::float_distance(a, b)) <= 1;
}
struct Xyz_tag {}; struct Xyz_tag {};
struct Xy_tag {}; struct Xy_tag {};

View File

@ -19,6 +19,7 @@
#define CGAL__TEST_CLS_AFF_TRANSFORMATION_2_H #define CGAL__TEST_CLS_AFF_TRANSFORMATION_2_H
#include <CGAL/use.h> #include <CGAL/use.h>
#include <CGAL/utils.h>
template <class R> template <class R>
bool bool
@ -29,7 +30,7 @@ _test_cls_aff_transformation_2(const R& )
typedef typename R::RT RT; typedef typename R::RT RT;
typedef typename R::FT FT; typedef typename R::FT FT;
const bool nonexact = std::is_same<FT, double>::value; const bool nonexact = std::is_floating_point<FT>::value;
typename R::Aff_transformation_2 ia; typename R::Aff_transformation_2 ia;
CGAL::Aff_transformation_2<R> a1(ia); CGAL::Aff_transformation_2<R> a1(ia);
@ -280,10 +281,16 @@ _test_cls_aff_transformation_2(const R& )
assert( pnt.transform(gat1) == pnt.transform(co1) ); assert( pnt.transform(gat1) == pnt.transform(co1) );
assert( lin.transform(gat1) == lin.transform(co1) ); assert( lin.transform(gat1) == lin.transform(co1) );
co1 = gat1 * gat1.inverse() ; co1 = gat1 * gat1.inverse() ;
assert( vec == vec.transform(co1) ); assert( vec == vec.transform(co1) || nonexact );
assert( pnt == pnt.transform(co1) || nonexact); assert( (vec - vec.transform(co1)).squared_length() < 1e-10);
assert( dir == dir.transform(co1) ); assert( pnt == pnt.transform(co1) || nonexact );
assert( lin == lin.transform(co1) ); assert( (pnt - pnt.transform(co1)).squared_length() < 1e-10);
auto unit = [](CGAL::Vector_2<R> v) { return v / CGAL::approximate_sqrt(v*v); };
assert( dir == dir.transform(co1) || nonexact);
assert( (unit(dir.to_vector()) - unit(dir.transform(co1).to_vector())).squared_length() < 1e-5);
assert( lin == lin.transform(co1) || nonexact );
// even // even
assert( translate.is_even() ); assert( translate.is_even() );
@ -340,10 +347,10 @@ _test_cls_aff_transformation_2(const R& )
assert( pnt == pnt.transform(co1) ); assert( pnt == pnt.transform(co1) );
assert( lin == lin.transform(co1) ); assert( lin == lin.transform(co1) );
co1 = rot3 * rot3 * rot3.inverse(); co1 = rot3 * rot3 * rot3.inverse();
assert( vec.transform(rot3) == vec.transform(co1) ); assert( vec.transform(rot3) == vec.transform(co1) || nonexact );
assert( dir.transform(rot3) == dir.transform(co1) ); assert( dir.transform(rot3) == dir.transform(co1) || nonexact );
assert( pnt.transform(rot3) == pnt.transform(co1) ); assert( pnt.transform(rot3) == pnt.transform(co1) || nonexact );
assert( lin.transform(rot3) == lin.transform(co1) ); assert( lin.transform(rot3) == lin.transform(co1) || nonexact );
//circle //circle
tp2 = p2.transform( translate ); tp2 = p2.transform( translate );
@ -628,11 +635,11 @@ _test_cls_aff_transformation_2(const R& )
comp2(trans*refl); comp2(trans*refl);
p1 = p.transform(trans); p1 = p.transform(trans);
p1 = p1.transform(refl); p1 = p1.transform(refl);
assert(p1 == CGAL::Point_2<R>(1,-2)); assert(p1 == CGAL::Point_2<R>(1,-2) || nonexact);
assert(p1 == p.transform(comp1) || nonexact); assert(p1 == p.transform(comp1) || nonexact);
p1 = p.transform(refl); p1 = p.transform(refl);
p1 = p1.transform(trans); p1 = p1.transform(trans);
assert(p1 == p.transform(comp2)); assert(p1 == p.transform(comp2) || nonexact);
//with scaling //with scaling
CGAL::Aff_transformation_2<R> scal(CGAL::SCALING, 2); CGAL::Aff_transformation_2<R> scal(CGAL::SCALING, 2);
comp1 = refl*scal; comp1 = refl*scal;
@ -661,7 +668,7 @@ _test_cls_aff_transformation_2(const R& )
comp2 = refl2*refl; comp2 = refl2*refl;
p1 = p.transform(refl2); p1 = p.transform(refl2);
p1 = p1.transform(refl); p1 = p1.transform(refl);
assert(p1 == p.transform(comp1)); assert(p1 == p.transform(comp1) || nonexact);
p1 = p.transform(refl); p1 = p.transform(refl);
p1 = p1.transform(refl2); p1 = p1.transform(refl2);
assert(p1 == p.transform(comp2) || nonexact); assert(p1 == p.transform(comp2) || nonexact);

View File

@ -28,7 +28,7 @@ _test_cls_aff_transformation_3(const R& )
typedef typename R::RT RT; typedef typename R::RT RT;
typedef typename R::FT FT; typedef typename R::FT FT;
const bool nonexact = std::is_same<FT, double>::value; const bool nonexact = std::is_floating_point<FT>::value;
typename R::Aff_transformation_3 ia; typename R::Aff_transformation_3 ia;
CGAL::Aff_transformation_3<R> a1(ia); CGAL::Aff_transformation_3<R> a1(ia);
@ -97,7 +97,7 @@ _test_cls_aff_transformation_3(const R& )
n5, n11, n10, n4, n5, n11, n10, n4,
n3, n6, n12, n2, n3, n6, n12, n2,
n3 ); n3 );
assert( p1 == (p1.transform(gat1)).transform(gat1.inverse() ) ); assert( p1 == (p1.transform(gat1)).transform(gat1.inverse() ) || nonexact );
CGAL::Aff_transformation_3<R> gat2( n7, n9, n8, n2, CGAL::Aff_transformation_3<R> gat2( n7, n9, n8, n2,
n5, n11, n10, n4, n5, n11, n10, n4,

View File

@ -77,7 +77,7 @@ _test_cls_circle_2(const R& )
typename R::Circle_2 ic; typename R::Circle_2 ic;
CGAL::Circle_2<R> c0; CGAL::Circle_2<R> c0;
const bool nonexact = std::is_same<FT, double>::value; const bool nonexact = std::is_floating_point<FT>::value;
RT n0 = 0; RT n0 = 0;
RT n1 = 16; RT n1 = 16;

View File

@ -29,7 +29,7 @@ _test_cls_line_3(const R& )
typedef typename R::RT RT; typedef typename R::RT RT;
typedef typename R::FT FT; typedef typename R::FT FT;
const bool nonexact = std::is_same<RT, double>::value; const bool nonexact = std::is_floating_point<RT>::value;
typename R::Line_3 il; typename R::Line_3 il;
CGAL::Line_3<R> l0( il ); CGAL_USE(l0); CGAL::Line_3<R> l0( il ); CGAL_USE(l0);

View File

@ -32,7 +32,7 @@ _test_cls_sphere_3(const R& )
typename R::Sphere_3 ic; typename R::Sphere_3 ic;
CGAL::Sphere_3<R> c0; CGAL::Sphere_3<R> c0;
const bool nonexact = std::is_same<FT, double>::value; const bool nonexact = std::is_floating_point<FT>::value;
RT n0 = 0; RT n0 = 0;
RT n1 = 16; RT n1 = 16;
RT n2 = -4; RT n2 = -4;

View File

@ -26,7 +26,7 @@ _test_fct_points_implicit_sphere(const R&)
typedef typename R::FT FT; typedef typename R::FT FT;
typedef CGAL::Tetrahedron_3<R> Tetrahedron; typedef CGAL::Tetrahedron_3<R> Tetrahedron;
const bool nonexact = std::is_same<FT, double>::value; const bool nonexact = std::is_floating_point<FT>::value;
const RT RT0(0); const RT RT0(0);
const RT RT4(4); const RT RT4(4);

View File

@ -31,7 +31,7 @@ _test_fct_weighted_point_3(const R& )
std::cout << "Testing functions Weighted_point_3" ; std::cout << "Testing functions Weighted_point_3" ;
typedef typename R::RT RT; typedef typename R::RT RT;
const bool nonexact = std::is_same<RT, double>::value; const bool nonexact = std::is_floating_point<RT>::value;
CGAL::Point_3<R> p1(RT(18), RT(15), RT(-21), RT(3) ); // 6, 5, -7 CGAL::Point_3<R> p1(RT(18), RT(15), RT(-21), RT(3) ); // 6, 5, -7
CGAL::Point_3<R> p2(RT(18), RT(15), RT( 12), RT(3) ); // 6, 5, 4 CGAL::Point_3<R> p2(RT(18), RT(15), RT( 12), RT(3) ); // 6, 5, 4

View File

@ -94,7 +94,7 @@ _test_further_fct_point_2(const R& )
using CGAL::testsuite::approx_equal; using CGAL::testsuite::approx_equal;
using CGAL::testsuite::Direction_2_tag; using CGAL::testsuite::Direction_2_tag;
const bool nonexact = std::is_same<FT, double>::value; const bool nonexact = std::is_floating_point<FT>::value;
assert( approx_equal((p5 - CGAL::ORIGIN).direction(), dir5, Direction_2_tag()) ); assert( approx_equal((p5 - CGAL::ORIGIN).direction(), dir5, Direction_2_tag()) );

View File

@ -29,7 +29,7 @@ _test_mf_plane_3_to_2d(const R& )
typedef CGAL::Point_3< R> Point_3; typedef CGAL::Point_3< R> Point_3;
typedef CGAL::Point_2< R> Point_2; typedef CGAL::Point_2< R> Point_2;
const bool nonexact = std::is_same<RT, double>::value; const bool nonexact = std::is_floating_point<RT>::value;
RT n0 = 0; RT n0 = 0;
RT n1 = 7; RT n1 = 7;
@ -68,11 +68,11 @@ _test_mf_plane_3_to_2d(const R& )
Point_3 p6( n4, n5, n0, n8); Point_3 p6( n4, n5, n0, n8);
Plane_3 pl3( p4, p5, p6); Plane_3 pl3( p4, p5, p6);
assert( p4 == pl3.to_3d( pl3.to_2d( p4)) || nonexact ); assert( p4 == pl3.to_3d( pl3.to_2d( p4)) || nonexact );
assert( p5 == pl3.to_3d( pl3.to_2d( p5)) || nonexact); assert( p5 == pl3.to_3d( pl3.to_2d( p5)) || nonexact );
assert( p6 == pl3.to_3d( pl3.to_2d( p6)) || nonexact ); assert( p6 == pl3.to_3d( pl3.to_2d( p6)) || nonexact );
Plane_3 pl4( p4, p6, p5); Plane_3 pl4( p4, p6, p5);
assert( p4 == pl4.to_3d( pl4.to_2d( p4)) || nonexact ); assert( p4 == pl4.to_3d( pl4.to_2d( p4)) || nonexact );
assert( p5 == pl4.to_3d( pl4.to_2d( p5)) || nonexact); assert( p5 == pl4.to_3d( pl4.to_2d( p5)) || nonexact );
assert( p6 == pl4.to_3d( pl4.to_2d( p6)) || nonexact ); assert( p6 == pl4.to_3d( pl4.to_2d( p6)) || nonexact );
Point_3 p7 = CGAL::midpoint( p1, p2); Point_3 p7 = CGAL::midpoint( p1, p2);

View File

@ -54,6 +54,7 @@ public:
typedef Apollonius_graph_traits_2<Geom_traits> Apollonius_traits; typedef Apollonius_graph_traits_2<Geom_traits> Apollonius_traits;
typedef Apollonius_graph_2<Apollonius_traits> Apollonius_graph; typedef Apollonius_graph_2<Apollonius_traits> Apollonius_graph;
typedef typename Apollonius_traits::Site_2 Site; typedef typename Apollonius_traits::Site_2 Site;
typedef typename Sizing_field_2<Tr>::FT FT;
public: public:
typedef std::list<Site> Site_set_2; typedef std::list<Site> Site_set_2;
@ -144,12 +145,12 @@ public:
return *this; return *this;
} }
double operator()(const Point& p) const FT operator()(const Point& p) const override
{ {
if(points.empty() || points.size() == 1) if(points.empty() || points.size() == 1)
return K; return FT(K);
Site ns = (*ag.nearest_neighbor(p)).site(); Site ns = (*ag.nearest_neighbor(p)).site();
return K * weighted_distance(p, ns); return FT(K * weighted_distance(p, ns));
} }
void set_K(double k) void set_K(double k)

View File

@ -24,8 +24,7 @@ namespace params = CGAL::parameters;
// Domain // Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point; typedef K::Point_3 Point;
typedef K::FT FT; typedef double (*Function)(const Point&);
typedef FT (*Function)(const Point&);
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function> typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
Function_wrapper; Function_wrapper;
typedef Function_wrapper::Function_vector Function_vector; typedef Function_wrapper::Function_vector Function_vector;

View File

@ -25,8 +25,7 @@ namespace params = CGAL::parameters;
// Domain // Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point; typedef K::Point_3 Point;
typedef K::FT FT; typedef double (*Function)(const Point&);
typedef FT (*Function)(const Point&);
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function> typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
Function_wrapper; Function_wrapper;
typedef Function_wrapper::Function_vector Function_vector; typedef Function_wrapper::Function_vector Function_vector;

View File

@ -22,7 +22,7 @@ typedef CGAL::Sequential_tag Concurrency_tag;
// Domain // Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef FT_to_point_function_wrapper<K::FT, K::Point_3> Function; typedef FT_to_point_function_wrapper<double, K::Point_3> Function;
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function> typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
Function_wrapper; Function_wrapper;
typedef Function_wrapper::Function_vector Function_vector; typedef Function_wrapper::Function_vector Function_vector;

View File

@ -14,7 +14,7 @@
// Domain // Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef FT_to_point_function_wrapper<K::FT, K::Point_3> Function; typedef FT_to_point_function_wrapper<double, K::Point_3> Function;
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function> typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
Function_wrapper; Function_wrapper;
typedef Function_wrapper::Function_vector Function_vector; typedef Function_wrapper::Function_vector Function_vector;

View File

@ -3478,7 +3478,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
// In some cases point is not a real surface point // In some cases point is not a real surface point
if ( triangles.empty() ) if ( triangles.empty() )
return std::make_pair(boost::none, Bare_point()); return std::make_pair(boost::none, Bare_point(ORIGIN));
// Compute least square fitting plane // Compute least square fitting plane
Plane_3 plane; Plane_3 plane;
@ -3490,7 +3490,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
point, point,
Dimension_tag<2>(), Dimension_tag<2>(),
tr_.geom_traits(), tr_.geom_traits(),
Default_diagonalize_traits<FT, 3>()); Default_diagonalize_traits<double, 3>());
return std::make_pair(plane, return std::make_pair(plane,
ref_facet.first->get_facet_surface_center(ref_facet.second)); ref_facet.first->get_facet_surface_center(ref_facet.second));
@ -3759,7 +3759,7 @@ min_sliver_value(const Cell_vector& cells,
it != cells.end(); it != cells.end();
++it) ++it)
{ {
min_value = (std::min)(criterion(*it), min_value); min_value = (std::min<FT>)(criterion(*it), min_value);
} }
return min_value; return min_value;
} }

View File

@ -1366,8 +1366,8 @@ refine_balls()
FT ra = get_radius(va); FT ra = get_radius(va);
FT rb = get_radius(vb); FT rb = get_radius(vb);
FT sa_new = (std::min)(ab/distance_divisor, ra); FT sa_new = (std::min)(FT(ab/distance_divisor), ra);
FT sb_new = (std::min)(ab/distance_divisor, rb); FT sb_new = (std::min)(FT(ab/distance_divisor), rb);
// In case of va or vb have already been in conflict, keep minimal size // In case of va or vb have already been in conflict, keep minimal size
if ( new_sizes.find(va) != new_sizes.end() ) if ( new_sizes.find(va) != new_sizes.end() )

View File

@ -270,7 +270,7 @@ struct Sizing_field_with_aabb_tree
<< ", index=#" << CGAL::IO::oformat(id) << "): "; << ", index=#" << CGAL::IO::oformat(id) << "): ";
} }
#endif // CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY #endif // CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY
double result = d_ptr->d_; FT result = d_ptr->d_;
if(dim == 0) { if(dim == 0) {
if(d_ptr->dt.dimension() < 1) { if(d_ptr->dt.dimension() < 1) {
#ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY #ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY
@ -311,7 +311,7 @@ struct Sizing_field_with_aabb_tree
} }
const FT dist = CGAL_NTS sqrt(CGAL::squared_distance( nearest, p)); const FT dist = CGAL_NTS sqrt(CGAL::squared_distance( nearest, p));
// std::cerr << (std::min)(dist / FT(1.5), d_) << "\n"; // std::cerr << (std::min)(dist / FT(1.5), d_) << "\n";
result = (std::min)(dist / FT(2), result); result = (std::min)(dist * FT(0.5), result);
// now search in the AABB tree // now search in the AABB tree
typename Corners_indices::const_iterator ids_it = typename Corners_indices::const_iterator ids_it =
@ -327,10 +327,10 @@ struct Sizing_field_with_aabb_tree
if(closest_point_and_primitive != boost::none) { if(closest_point_and_primitive != boost::none) {
result = result =
(std::min)(0.9 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) * (std::min)(FT(0.9 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) *
CGAL_NTS CGAL_NTS
sqrt(CGAL::squared_distance(p, sqrt(CGAL::squared_distance(p,
closest_point_and_primitive->first)), closest_point_and_primitive->first))),
result); result);
#ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY #ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY
{ {
@ -395,10 +395,10 @@ struct Sizing_field_with_aabb_tree
closest_point_and_primitive->second)) == 0); closest_point_and_primitive->second)) == 0);
result = result =
(std::min)(0.9 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) * (std::min)(FT(0.9 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) *
CGAL_NTS CGAL_NTS
sqrt(CGAL::squared_distance(p, sqrt(CGAL::squared_distance(p,
closest_point_and_primitive->first)), closest_point_and_primitive->first))),
result); result);
#ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY #ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY
@ -562,9 +562,9 @@ struct Sizing_field_with_aabb_tree
std::cerr << " closest_point: " << closest_intersection << "\n" std::cerr << " closest_point: " << closest_intersection << "\n"
<< " distance = " << CGAL_NTS sqrt(sqd_intersection) << std::endl; << " distance = " << CGAL_NTS sqrt(sqd_intersection) << std::endl;
#endif // CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY #endif // CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY
double new_result = FT new_result =
(std::min)(0.45 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) * (std::min)(FT(0.45 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) *
CGAL_NTS sqrt(sqd_intersection), CGAL_NTS sqrt(sqd_intersection)),
d_ptr->d_); d_ptr->d_);
#ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY #ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY

View File

@ -81,20 +81,20 @@ int main()
Mc ec3(edge_sizing_field = 3.); Mc ec3(edge_sizing_field = 3.);
assert( ec3.edge_criteria_object().sizing_field(bp1,1,index) == 3 ); assert( ec3.edge_criteria_object().sizing_field(bp1,1,index) == 3 );
Mc ec4(edge_size = 4.1, Mc ec4(edge_size = 4.,
edge_sizing_field = Esf(4.2)); edge_sizing_field = Esf(5.));
assert( ec4.edge_criteria_object().sizing_field(bp1,1,index) == 4.1 ); assert( ec4.edge_criteria_object().sizing_field(bp1,1,index) == 4. );
Mc ec5(sizing_field = 5.); Mc ec5(sizing_field = 5.);
assert( ec5.edge_criteria_object().sizing_field(bp1,1,index) == 5 ); assert( ec5.edge_criteria_object().sizing_field(bp1,1,index) == 5 );
Mc ec6(sizing_field = 6.1, Mc ec6(sizing_field = 6.,
edge_sizing_field = 6.2); edge_sizing_field = 7.);
assert( ec6.edge_criteria_object().sizing_field(bp1,1,index) == 6.2 ); assert( ec6.edge_criteria_object().sizing_field(bp1,1,index) == 7. );
Mc ec7(sizing_field = 7.1, Mc ec7(sizing_field = 7.,
edge_size = 7.2); edge_size = 8.);
assert( ec7.edge_criteria_object().sizing_field(bp1,1,index) == 7.2 ); assert( ec7.edge_criteria_object().sizing_field(bp1,1,index) == 8. );
// ----------------------------------- // -----------------------------------

View File

@ -1,3 +1,4 @@
#define CGAL_MESH_3_VERBOSE 1
// Copyright (c) 2009 INRIA Sophia-Antipolis (France). // Copyright (c) 2009 INRIA Sophia-Antipolis (France).
// All rights reserved. // All rights reserved.
// //
@ -48,7 +49,7 @@ public:
<< CGAL::get_default_random().get_seed() << std::endl; << CGAL::get_default_random().get_seed() << std::endl;
Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain
(image, (image,
CGAL::parameters::relative_error_bound = 1e-9, CGAL::parameters::relative_error_bound = 1e-6,
CGAL::parameters::p_rng = &CGAL::get_default_random()); CGAL::parameters::p_rng = &CGAL::get_default_random());
// Set mesh criteria // Set mesh criteria
@ -78,6 +79,7 @@ public:
int main() int main()
{ {
std::cerr.precision(17);
Image_tester<> test_epic; Image_tester<> test_epic;
std::cerr << "Mesh generation from a 3D image:\n"; std::cerr << "Mesh generation from a 3D image:\n";
test_epic.image(); test_epic.image();

View File

@ -1,3 +1,4 @@
#define CGAL_MESH_3_VERBOSE 1
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h> #include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include "test_meshing_utilities.h" #include "test_meshing_utilities.h"
@ -33,7 +34,7 @@ public:
std::cout << "\tSeed is\t" std::cout << "\tSeed is\t"
<< CGAL::get_default_random().get_seed() << std::endl; << CGAL::get_default_random().get_seed() << std::endl;
Mesh_domain domain(image, 1e-9, &CGAL::get_default_random()); Mesh_domain domain(image, 1e-6, &CGAL::get_default_random());
// Set mesh criteria // Set mesh criteria
Facet_criteria facet_criteria(25, 20*image.vx(), 5*image.vx()); Facet_criteria facet_criteria(25, 20*image.vx(), 5*image.vx());

View File

@ -381,7 +381,7 @@ struct Tester
continue; continue;
max_sqd = (std::max)(max_sqd, max_sqd = (std::max)(max_sqd,
aabb_tree.squared_distance(CGAL::centroid(tr.triangle(f)))); CGAL::to_double(aabb_tree.squared_distance(CGAL::centroid(tr.triangle(f)))));
} }
double hdist = std::sqrt(max_sqd); double hdist = std::sqrt(max_sqd);
std::cout << "\tHausdorff distance to polyhedron is " << hdist << std::endl; std::cout << "\tHausdorff distance to polyhedron is " << hdist << std::endl;

View File

@ -85,7 +85,7 @@ public:
Simplex offspring; Simplex offspring;
for(int j=0; j<4; ++j) for(int j=0; j<4; ++j)
{ {
const FT r{m_rng.get_double()}; const FT r{m_rng.uniform_01<FT>()};
const FT fitnessA = m_population[group1[i]][j].fitness(); const FT fitnessA = m_population[group1[i]][j].fitness();
const FT fitnessB = m_population[group2[i]][j].fitness(); const FT fitnessB = m_population[group2[i]][j].fitness();
const FT threshold = (fitnessA < fitnessB) ? uweight : lweight; const FT threshold = (fitnessA < fitnessB) ? uweight : lweight;

View File

@ -39,8 +39,10 @@ compute_fitness(const typename Traits::Matrix& R, // rotation matrix
CGAL_assertion(points.size() >= 3); CGAL_assertion(points.size() >= 3);
FT xmin, ymin, zmin, xmax, ymax, zmax; FT xmin, ymin, zmin, xmax, ymax, zmax;
xmin = ymin = zmin = FT{(std::numeric_limits<double>::max)()}; //cast from double to float looses data, so cast with {} is not allowed
xmax = ymax = zmax = FT{std::numeric_limits<double>::lowest()}; //cast from double to exact types also works
xmin = ymin = zmin = FT((std::numeric_limits<double>::max)());
xmax = ymax = zmax = FT(std::numeric_limits<double>::lowest());
for(const Point& pt : points) for(const Point& pt : points)
{ {
@ -81,8 +83,10 @@ compute_fitness_if_smaller(const typename Traits::Matrix& R, // rotation matrix
CGAL_assertion(points.size() >= 3); CGAL_assertion(points.size() >= 3);
FT xmin, ymin, zmin, xmax, ymax, zmax; FT xmin, ymin, zmin, xmax, ymax, zmax;
xmin = ymin = zmin = FT{(std::numeric_limits<double>::max)()}; //cast from double to float looses data, so cast with {} is not allowed
xmax = ymax = zmax = FT{std::numeric_limits<double>::lowest()}; //cast from double to exact types also works
xmin = ymin = zmin = FT((std::numeric_limits<double>::max)());
xmax = ymax = zmax = FT(std::numeric_limits<double>::lowest());
// compute every 1%, with a minimum of 1000 iterations // compute every 1%, with a minimum of 1000 iterations
const std::size_t pn = points.size(); const std::size_t pn = points.size();

View File

@ -104,7 +104,9 @@ compute_2D_deviation(const PointRange& points,
if(theta > 0.25 * CGAL_PI) // @todo is there a point to this if(theta > 0.25 * CGAL_PI) // @todo is there a point to this
theta = 0.5 * CGAL_PI - theta; theta = 0.5 * CGAL_PI - theta;
return std::make_pair(pol.area(), FT{theta}); //cast from double to float looses data, so cast with {} is not allowed
//cast from double to exact types also works
return std::make_pair(pol.area(), FT(theta));
} }
template <typename PointRange, typename Traits> template <typename PointRange, typename Traits>
@ -123,8 +125,10 @@ void optimize_along_OBB_axes(typename Traits::Matrix& rot,
rotated_points.reserve(points.size()); rotated_points.reserve(points.size());
FT xmin, ymin, zmin, xmax, ymax, zmax; FT xmin, ymin, zmin, xmax, ymax, zmax;
xmin = ymin = zmin = FT{(std::numeric_limits<double>::max)()}; //cast from double to float looses data, so cast with {} is not allowed
xmax = ymax = zmax = FT{std::numeric_limits<double>::lowest()}; //cast from double to exact types also works
xmin = ymin = zmin = FT((std::numeric_limits<double>::max)());
xmax = ymax = zmax = FT(std::numeric_limits<double>::lowest());
for(const Point& pt : points) for(const Point& pt : points)
{ {

View File

@ -121,7 +121,9 @@ public:
Vertex& get_best_vertex() Vertex& get_best_vertex()
{ {
std::size_t simplex_id = static_cast<std::size_t>(-1), vertex_id = static_cast<std::size_t>(-1); std::size_t simplex_id = static_cast<std::size_t>(-1), vertex_id = static_cast<std::size_t>(-1);
FT best_fitness = FT{(std::numeric_limits<double>::max)()}; //cast from double to float looses data, so cast with {} is not allowed
//cast from double to exact types also works
FT best_fitness = FT((std::numeric_limits<double>::max)());
for(std::size_t i=0, ps=m_simplices.size(); i<ps; ++i) for(std::size_t i=0, ps=m_simplices.size(); i<ps; ++i)
{ {
for(std::size_t j=0; j<4; ++j) for(std::size_t j=0; j<4; ++j)

View File

@ -84,10 +84,11 @@ namespace CGAL {
const Point &b, const Point &b,
const Point &c) const Point &c)
{ {
internal::covariance_matrix_tetrahedron (a[0], a[1], a[2], internal::covariance_matrix_tetrahedron(
b[0], b[1], b[2], FT(a[0]), FT(a[1]), FT(a[2]),
c[0], c[1], c[2], FT(b[0]), FT(b[1]), FT(b[2]),
_result); FT(c[0]), FT(c[1]), FT(c[2]),
_result);
} }
const Result_type &result() const const Result_type &result() const
@ -192,31 +193,29 @@ namespace CGAL {
const Sphere &sphere, const Sphere &sphere,
FT covariance[6]) FT covariance[6])
{ {
typename internal::Covariance_accumulator_3<FT> ca; typename internal::Covariance_accumulator_3<double> ca;
internal::tessellate_and_intersect(dt, v, sphere, ca); internal::tessellate_and_intersect(dt, v, sphere, ca);
std::copy (ca.result().begin(), ca.result().end(), covariance); std::copy (ca.result().begin(), ca.result().end(), covariance);
} }
template <class DT, class Sphere> template <class DT, class Sphere>
std::array<typename DT::Geom_traits::FT, 6> std::array<double, 6>
voronoi_covariance_3 (const DT &dt, voronoi_covariance_3 (const DT &dt,
typename DT::Vertex_handle v, typename DT::Vertex_handle v,
const Sphere &sphere) const Sphere &sphere)
{ {
typedef typename DT::Geom_traits::FT FT; typename internal::Covariance_accumulator_3<double> ca;
typename internal::Covariance_accumulator_3<FT> ca;
return internal::tessellate_and_intersect(dt, v, sphere, ca).result(); return internal::tessellate_and_intersect(dt, v, sphere, ca).result();
} }
template <class DT, class Sphere> template <class DT, class Sphere>
typename DT::Geom_traits::FT double
voronoi_volume_3 (const DT &dt, voronoi_volume_3 (const DT &dt,
typename DT::Vertex_handle v, typename DT::Vertex_handle v,
const Sphere &sphere) const Sphere &sphere)
{ {
typedef typename DT::Geom_traits::FT FT; typename internal::Volume_accumulator_3<double> va;
typename internal::Volume_accumulator_3<FT> va;
return internal::tessellate_and_intersect(dt, v, sphere, va).result(); return internal::tessellate_and_intersect(dt, v, sphere, va).result();
} }

View File

@ -89,8 +89,8 @@ compute_denoise_projection(
FT project_weight_sum = FT(0.0); FT project_weight_sum = FT(0.0);
Vector normal_sum = CGAL::NULL_VECTOR; Vector normal_sum = CGAL::NULL_VECTOR;
FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0); FT cos_sigma = cos(FT(sharpness_angle * CGAL_PI / 180.0));
FT sharpness_bandwidth = CGAL::square((CGAL::max)(1e-8, 1 - cos_sigma)); FT sharpness_bandwidth = CGAL::square((CGAL::max)(FT(1e-8), FT(1.) - cos_sigma));
for (typename PointRange::iterator it : neighbor_pwns) for (typename PointRange::iterator it : neighbor_pwns)
{ {
@ -150,7 +150,7 @@ compute_max_spacing(
boost::make_function_output_iterator boost::make_function_output_iterator
([&](const typename NeighborQuery::input_iterator& it) ([&](const typename NeighborQuery::input_iterator& it)
{ {
double dist2 = CGAL::squared_distance (get(point_map, vt), get(point_map, *it)); FT dist2 = CGAL::squared_distance (get(point_map, vt), get(point_map, *it));
max_distance = (CGAL::max)(dist2, max_distance); max_distance = (CGAL::max)(dist2, max_distance);
})); }));

View File

@ -242,7 +242,7 @@ namespace CGAL {
} }
// Compute the covariance matrix of the set // Compute the covariance matrix of the set
std::array<FT, 6> covariance = {{ 0., 0., 0., 0., 0., 0. }}; std::array<double, 6> covariance = {{ 0., 0., 0., 0., 0., 0. }};
for (typename std::list<Input_type>::iterator it = current_cluster->first.begin (); for (typename std::list<Input_type>::iterator it = current_cluster->first.begin ();
it != current_cluster->first.end (); ++ it) it != current_cluster->first.end (); ++ it)
@ -257,8 +257,8 @@ namespace CGAL {
covariance[5] += d.z () * d.z (); covariance[5] += d.z () * d.z ();
} }
std::array<FT, 3> eigenvalues = {{ 0., 0., 0. }}; std::array<double, 3> eigenvalues = {{ 0., 0., 0. }};
std::array<FT, 9> eigenvectors = {{ 0., 0., 0., std::array<double, 9> eigenvectors = {{ 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0. }}; 0., 0., 0. }};
// Linear algebra = get eigenvalues and eigenvectors for // Linear algebra = get eigenvalues and eigenvectors for
@ -279,7 +279,7 @@ namespace CGAL {
// The plane which splits the point set into 2 point sets: // The plane which splits the point set into 2 point sets:
// * Normal to the eigenvector with highest eigenvalue // * Normal to the eigenvector with highest eigenvalue
// * Passes through the centroid of the set // * Passes through the centroid of the set
Vector v (eigenvectors[6], eigenvectors[7], eigenvectors[8]); Vector v (FT(eigenvectors.at(6)), FT(eigenvectors.at(7)), FT(eigenvectors.at(8)));
std::size_t current_cluster_size = 0; std::size_t current_cluster_size = 0;
typename std::list<Input_type>::iterator it = current_cluster->first.begin (); typename std::list<Input_type>::iterator it = current_cluster->first.begin ();

View File

@ -328,7 +328,7 @@ void orient_scanline (Iterator begin, Iterator end,
const Point_3& p = get (point_map, *it); const Point_3& p = get (point_map, *it);
mean_x += p.x(); mean_x += p.x();
mean_y += p.y(); mean_y += p.y();
max_z = (std::max)(max_z, p.z()); max_z = (std::max)(max_z, CGAL::to_double(p.z()));
++ nb; ++ nb;
} }

View File

@ -22,9 +22,9 @@ double max_coordinate(const Polyhedron& poly)
for(Polyhedron::Vertex_handle v : vertices(poly)) for(Polyhedron::Vertex_handle v : vertices(poly))
{ {
Point p = v->point(); Point p = v->point();
max_coord = (std::max)(max_coord, p.x()); max_coord = (std::max)(max_coord, CGAL::to_double(p.x()));
max_coord = (std::max)(max_coord, p.y()); max_coord = (std::max)(max_coord, CGAL::to_double(p.y()));
max_coord = (std::max)(max_coord, p.z()); max_coord = (std::max)(max_coord, CGAL::to_double(p.z()));
} }
return max_coord; return max_coord;
} }

View File

@ -127,7 +127,7 @@ public:
const Eigen_vector& bx, const Eigen_vector& by, const Eigen_vector& bz, const Eigen_vector& bx, const Eigen_vector& by, const Eigen_vector& bz,
SparseLinearSolver& solver) SparseLinearSolver& solver)
{ {
FT D; double D;
// calls compute once to factorize with the preconditioner // calls compute once to factorize with the preconditioner
if(!solver.factor(A, D)) if(!solver.factor(A, D))

View File

@ -428,10 +428,10 @@ public:
const FT S_av = compute_average_area_around(v); const FT S_av = compute_average_area_around(v);
const FT initial_x = vp.x(); const double initial_x = CGAL::to_double(vp.x());
const FT initial_y = vp.y(); const double initial_y = CGAL::to_double(vp.y());
const FT initial_z = vp.z(); const double initial_z = CGAL::to_double(vp.z());
FT x = initial_x, y = initial_y, z = initial_z; double x = initial_x, y = initial_y, z = initial_z;
ceres::Problem problem; ceres::Problem problem;
@ -468,7 +468,7 @@ public:
// std::cout << "y : " << initial_y << " -> " << y << "\n"; // std::cout << "y : " << initial_y << " -> " << y << "\n";
// std::cout << "z : " << initial_z << " -> " << z << "\n"; // std::cout << "z : " << initial_z << " -> " << z << "\n";
return Vector(x - initial_x, y - initial_y, z - initial_z); return Vector(FT(x - initial_x), FT(y - initial_y), FT(z - initial_z))l;
#else #else
CGAL_USE(v); CGAL_USE(v);
return CGAL::NULL_VECTOR; return CGAL::NULL_VECTOR;

View File

@ -585,7 +585,7 @@ bool build_triangulation_from_file(std::istream& is,
is >> nv; is >> nv;
for(int i=0; i<nv; ++i) for(int i=0; i<nv; ++i)
{ {
double x,y,z; typename Tr::Geom_traits::FT x,y,z;
is >> x >> y >> z >> ref; is >> x >> y >> z >> ref;
points.push_back(Point_3(x,y,z)); points.push_back(Point_3(x,y,z));
} }

View File

@ -27,6 +27,18 @@ struct is_same_or_derived :
>::type >::type
{}; {};
} namespace cpp20 {
template< class T >
struct remove_cvref {
typedef std::remove_cv_t<std::remove_reference_t<T>> type;
};
template< class T >
using remove_cvref_t = typename remove_cvref<T>::type;
} // end namespace cpp20
} // end namespace CGAL
#endif // CGAL_TYPE_TRAITS_H #endif // CGAL_TYPE_TRAITS_H

View File

@ -40,7 +40,7 @@ namespace CGAL {
operator()(P p) operator()(P p)
{ {
T h; T h;
typename Construct_cartesian_const_iterator_d::result_type pit = construct_it(*p); auto pit = construct_it(*p);
for (int i = 0; i < dim; ++i, ++pit) { for (int i = 0; i < dim; ++i, ++pit) {
h=(*pit); h=(*pit);
if (h < lower[i]) lower[i] = h; if (h < lower[i]) lower[i] = h;
@ -126,7 +126,7 @@ namespace CGAL {
if (begin ==end) if (begin ==end)
return; return;
// initialize with values of first point // initialize with values of first point
typename Construct_cartesian_const_iterator_d::result_type bit = construct_it(**begin); auto bit = construct_it(**begin);
for (int i=0; i < D::value; ++i, ++bit) { for (int i=0; i < D::value; ++i, ++bit) {
lower_[i]= *bit; upper_[i]=lower_[i]; lower_[i]= *bit; upper_[i]=lower_[i];

View File

@ -1125,7 +1125,7 @@ private:
// Solve "A*Xu = Bu". On success, the solution is (1/Du) * Xu. // Solve "A*Xu = Bu". On success, the solution is (1/Du) * Xu.
// Solve "A*Xv = Bv". On success, the solution is (1/Dv) * Xv. // Solve "A*Xv = Bv". On success, the solution is (1/Dv) * Xv.
NT Du, Dv; double Du, Dv;
if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) || if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) ||
!get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv)) { !get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv)) {
std::cerr << "Could not solve linear system" << std::endl; std::cerr << "Could not solve linear system" << std::endl;

View File

@ -267,7 +267,7 @@ public:
// Solve "A*Xu = Bu". On success, solution is (1/Du) * Xu. // Solve "A*Xu = Bu". On success, solution is (1/Du) * Xu.
// Solve "A*Xv = Bv". On success, solution is (1/Dv) * Xv. // Solve "A*Xv = Bv". On success, solution is (1/Dv) * Xv.
NT Du = 0, Dv = 0; double Du = 0, Dv = 0;
if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) || if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) ||
!get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv)) !get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv))
{ {

View File

@ -929,7 +929,7 @@ public:
// solve linear equations // solve linear equations
// Solve "A*Xu = Bu". On success, solution is (1/Du) * Xu. // Solve "A*Xu = Bu". On success, solution is (1/Du) * Xu.
// Solve "A*Xv = Bv". On success, solution is (1/Dv) * Xv. // Solve "A*Xv = Bv". On success, solution is (1/Dv) * Xv.
NT Du = 0, Dv = 0; double Du = 0, Dv = 0;
if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) || if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) ||
!get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv)) !get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv))
{ {

View File

@ -598,7 +598,7 @@ private:
{ {
Error_code status = OK; Error_code status = OK;
NT Du, Dv; double Du, Dv;
if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) || if(!get_linear_algebra_traits().linear_solver(A, Bu, Xu, Du) ||
!get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv)) { !get_linear_algebra_traits().linear_solver(A, Bv, Xv, Dv)) {
status = ERROR_CANNOT_SOLVE_LINEAR_SYSTEM; status = ERROR_CANNOT_SOLVE_LINEAR_SYSTEM;

View File

@ -839,7 +839,7 @@ private:
const int big_n = M.row_dimension(); const int big_n = M.row_dimension();
const std::size_t n = 2 * num_vertices(mesh); const std::size_t n = 2 * num_vertices(mesh);
NT D; double D;
Vector Xf(big_n); Vector Xf(big_n);
CGAL::Timer task_timer; CGAL::Timer task_timer;

View File

@ -143,13 +143,13 @@ public:
for(vertex_descriptor vd : vertices) { for(vertex_descriptor vd : vertices) {
const Point_3& position = get(ppmap,vd); const Point_3& position = get(ppmap,vd);
xmin = (std::min)(position.x(), xmin); xmin = (std::min)(CGAL::to_double(position.x()), xmin);
ymin = (std::min)(position.y(), ymin); ymin = (std::min)(CGAL::to_double(position.y()), ymin);
zmin = (std::min)(position.z(), zmin); zmin = (std::min)(CGAL::to_double(position.z()), zmin);
xmax = (std::max)(position.x(), xmax); xmax = (std::max)(CGAL::to_double(position.x()), xmax);
ymax = (std::max)(position.y(), ymax); ymax = (std::max)(CGAL::to_double(position.y()), ymax);
zmax = (std::max)(position.z(), zmax); zmax = (std::max)(CGAL::to_double(position.z()), zmax);
} }
// Find longest bounding box axes // Find longest bounding box axes

View File

@ -272,11 +272,11 @@ bool is_one_to_one_mapping(const TriangleMesh& mesh,
const Point_2& p1 = get(uvmap, vd1); const Point_2& p1 = get(uvmap, vd1);
const Point_2& p2 = get(uvmap, vd2); const Point_2& p2 = get(uvmap, vd2);
Bbox_2 b = p0.bbox(); NT bx[2] = { (std::min)(p0[0], (std::min)(p1[0], p2[0])),
b += p1.bbox(); (std::min)(p0[1], (std::min)(p1[1], p2[1])) };
b += p2.bbox(); NT by[2] = { (std::max)(p0[0], (std::max)(p1[0], p2[0])),
(std::max)(p0[1], (std::max)(p1[1], p2[1])) };
boxes.push_back(Box(b, fd)); boxes.emplace_back(bx, by, fd);
} }
std::vector<const Box*> boxes_ptr; std::vector<const Box*> boxes_ptr;

View File

@ -48,6 +48,7 @@ class Tetrahedral_remeshing_smoother
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Gt::Vector_3 Vector_3; typedef typename Gt::Vector_3 Vector_3;
typedef typename Gt::Point_3 Point_3; typedef typename Gt::Point_3 Point_3;
typedef typename Gt::FT FT;
private: private:
typedef CGAL::Tetrahedral_remeshing::internal::FMLS<Gt> FMLS; typedef CGAL::Tetrahedral_remeshing::internal::FMLS<Gt> FMLS;
@ -347,9 +348,9 @@ private:
const CellRange& inc_cells, const CellRange& inc_cells,
const Tr& /* tr */, const Tr& /* tr */,
#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE
double& total_move) FT& total_move)
#else #else
double&) FT&)
#endif #endif
{ {
const typename Tr::Point backup = v->point(); //backup v's position const typename Tr::Point backup = v->point(); //backup v's position

View File

@ -32,12 +32,12 @@ int main(int argc, char* argv[])
} }
//bbox //bbox
double xmin = points[0].x(); auto xmin = points[0].x();
double xmax = points[0].x(); auto xmax = points[0].x();
double ymin = points[0].y(); auto ymin = points[0].y();
double ymax = points[0].y(); auto ymax = points[0].y();
double zmin = points[0].z(); auto zmin = points[0].z();
double zmax = points[0].z(); auto zmax = points[0].z();
for(const Point_3& p : points) for(const Point_3& p : points)
{ {