Allow to use an Epick-like kernel with float as FT

This commit is contained in:
Laurent Rineau 2022-10-10 15:49:17 +02:00
parent 34d8e5cd5d
commit 0e823324c9
17 changed files with 37 additions and 34 deletions

View File

@ -12,6 +12,10 @@ bool approx_equal(double a, double b) {
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 Xy_tag {};

View File

@ -29,7 +29,7 @@ _test_cls_aff_transformation_2(const R& )
typedef typename R::RT RT;
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;
CGAL::Aff_transformation_2<R> a1(ia);

View File

@ -28,7 +28,7 @@ _test_cls_aff_transformation_3(const R& )
typedef typename R::RT RT;
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;
CGAL::Aff_transformation_3<R> a1(ia);

View File

@ -77,7 +77,7 @@ _test_cls_circle_2(const R& )
typename R::Circle_2 ic;
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 n1 = 16;

View File

@ -32,7 +32,7 @@ _test_cls_sphere_3(const R& )
typename R::Sphere_3 ic;
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 n1 = 16;
RT n2 = -4;

View File

@ -26,7 +26,7 @@ _test_fct_points_implicit_sphere(const R&)
typedef typename R::FT FT;
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 RT4(4);

View File

@ -94,7 +94,7 @@ _test_further_fct_point_2(const R& )
using CGAL::testsuite::approx_equal;
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()) );

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ typedef CGAL::Sequential_tag Concurrency_tag;
// Domain
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>
Function_wrapper;
typedef Function_wrapper::Function_vector Function_vector;

View File

@ -16,7 +16,7 @@ using namespace CGAL::parameters;
// Domain
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>
Function_wrapper;
typedef Function_wrapper::Function_vector Function_vector;

View File

@ -937,7 +937,7 @@ public:
* Warning: Here we don't check if cells are in c3t3
*/
template <typename SliverCriterion>
FT min_sliver_value(const Cell_vector& cells,
double min_sliver_value(const Cell_vector& cells,
const SliverCriterion& criterion,
const bool use_cache = true) const;
@ -3720,7 +3720,7 @@ number_of_incident_slivers(const Vertex_handle& v,
template <typename C3T3, typename MD>
template <typename SliverCriterion>
typename C3T3_helpers<C3T3,MD>::FT
double
C3T3_helpers<C3T3,MD>::
min_sliver_value(const Cell_vector& cells,
const SliverCriterion& criterion,
@ -3741,7 +3741,7 @@ min_sliver_value(const Cell_vector& cells,
//
//return *(std::min_element(make_transform_iterator(cells.begin(),sc_value),
// make_transform_iterator(cells.end(),sc_value)));
FT min_value = criterion.get_max_value();
double min_value = criterion.get_max_value();
for(typename Cell_vector::const_iterator it = cells.begin();
it != cells.end();
++it)

View File

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

View File

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

View File

@ -380,7 +380,7 @@ struct Tester
if(!c3t3.is_in_complex(f))
continue;
max_sqd = (std::max)(max_sqd,
max_sqd = (std::max<double>)(max_sqd,
aabb_tree.squared_distance(CGAL::centroid(tr.triangle(f))));
}
double hdist = std::sqrt(max_sqd);

View File

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