mirror of https://github.com/CGAL/cgal
use std tuple
This commit is contained in:
parent
4737f58130
commit
1b9dca6e1f
|
|
@ -25,7 +25,7 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <optional>
|
||||
|
||||
#define CGAL_NUMBER_OF_MAD 1.5
|
||||
|
|
@ -90,11 +90,11 @@ private:
|
|||
typedef typename Tree::Primitive_id Primitive_id;
|
||||
|
||||
// Sampled points from disk, t1 = coordinate-x, t2 = coordinate-y, t3 = weight.
|
||||
typedef boost::tuple<double, double, double> Disk_sample;
|
||||
typedef std::tuple<double, double, double> Disk_sample;
|
||||
typedef std::vector<Disk_sample> Disk_samples_list;
|
||||
|
||||
// DiskSampling class responsible for the sampling points in a disk. It is used for generating rays in the cones. For different example see Disk_samplers.h
|
||||
typedef Vogel_disk_sampling<boost::tuple<double, double, double> >
|
||||
typedef Vogel_disk_sampling<std::tuple<double, double, double> >
|
||||
Default_sampler;
|
||||
|
||||
// member variables
|
||||
|
|
@ -303,8 +303,8 @@ public:
|
|||
Primitive_id closest_id;
|
||||
|
||||
Vector disk_vector = sum_functor(
|
||||
scale_functor(v1, FT(disk_multiplier * sample_it->get<0>())),
|
||||
scale_functor(v2, FT(disk_multiplier * sample_it->get<1>())) );
|
||||
scale_functor(v1, FT(disk_multiplier * std::get<0>(*sample_it))),
|
||||
scale_functor(v2, FT(disk_multiplier * std::get<1>(*sample_it))) );
|
||||
Vector ray_direction = sum_functor(scaled_normal, disk_vector);
|
||||
|
||||
if(use_diagonal) {
|
||||
|
|
@ -342,7 +342,7 @@ public:
|
|||
|
||||
visitor(closest_id, min_distance);
|
||||
|
||||
ray_distances.push_back(std::make_pair(min_distance, sample_it->get<2>()));
|
||||
ray_distances.push_back(std::make_pair(min_distance, std::get<2>(*sample_it)));
|
||||
}
|
||||
|
||||
if(ray_distances.empty()) {
|
||||
|
|
@ -407,9 +407,9 @@ private:
|
|||
* - get<3> Primitive_id : closest intersected primitive if get<0> is true, else Primitive_id()
|
||||
*/
|
||||
template <class Query, class SkipPrimitiveFunctor>
|
||||
boost::tuple<bool, bool, double, Primitive_id> cast_and_return_minimum(
|
||||
std::tuple<bool, bool, double, Primitive_id> cast_and_return_minimum(
|
||||
const Query& query, SkipPrimitiveFunctor skip, bool accept_if_acute) const {
|
||||
boost::tuple<bool, bool, double, Primitive_id>
|
||||
std::tuple<bool, bool, double, Primitive_id>
|
||||
min_distance(false, false, 0.0, Primitive_id());
|
||||
|
||||
typedef typename Tree:: template Intersection_and_primitive_id<Query>::Type Intersection_and_primitive_id;
|
||||
|
|
@ -440,16 +440,16 @@ private:
|
|||
|
||||
Vector i_ray(*i_point, query.source());
|
||||
double new_distance = to_double( i_ray.squared_length() );
|
||||
if(!min_distance.template get<0>()
|
||||
|| new_distance < min_distance.template get<2>()) {
|
||||
min_distance.template get<3>() = id;
|
||||
min_distance.template get<2>() = new_distance;
|
||||
min_distance.template get<0>() = true;
|
||||
if(!std::get<0>(min_distance)
|
||||
|| new_distance < std::get<2>(min_distance)) {
|
||||
std::get<3>(min_distance) = id;
|
||||
std::get<2>(min_distance) = new_distance;
|
||||
std::get<0>(min_distance) = true;
|
||||
min_id = id;
|
||||
min_i_ray = i_ray;
|
||||
}
|
||||
}
|
||||
if(!min_distance.template get<0>()) {
|
||||
if(!std::get<0>(min_distance)) {
|
||||
return min_distance;
|
||||
}
|
||||
|
||||
|
|
@ -467,32 +467,32 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
min_distance.template get<1>() = true; // founded intersection is acceptable.
|
||||
min_distance.template get<2>() = std::sqrt(min_distance.template get<2>());
|
||||
std::get<1>(min_distance) = true; // founded intersection is acceptable.
|
||||
std::get<2>(min_distance) = std::sqrt(std::get<2>(min_distance));
|
||||
return min_distance;
|
||||
}
|
||||
|
||||
// function similar to `cast_and_return_minimum()` but using the function
|
||||
// first_intersection with a Ray to get the closest intersected primitive
|
||||
template<typename SkipFunctor>
|
||||
boost::tuple<bool, bool, double, Primitive_id> ray_casting(
|
||||
std::tuple<bool, bool, double, Primitive_id> ray_casting(
|
||||
const Ray& query, SkipFunctor s, bool accept_if_acute) const {
|
||||
|
||||
const std::optional< typename Tree::template Intersection_and_primitive_id<Ray>::Type >
|
||||
min_intersection = tree.first_intersection(query, s);
|
||||
if(!min_intersection)
|
||||
return boost::make_tuple(false, false, 0.0, Primitive_id());
|
||||
return std::make_tuple(false, false, 0.0, Primitive_id());
|
||||
|
||||
const Point* i_point = std::get_if<Point>( &min_intersection->first );
|
||||
if (!i_point) //segment case ignored
|
||||
return boost::make_tuple(false, false, 0.0, Primitive_id());
|
||||
return std::make_tuple(false, false, 0.0, Primitive_id());
|
||||
|
||||
Vector min_i_ray(*i_point, query.source());
|
||||
|
||||
boost::tuple<bool, bool, double, Primitive_id>
|
||||
std::tuple<bool, bool, double, Primitive_id>
|
||||
min_distance(true, false, to_double(min_i_ray.squared_length()), min_intersection->second);
|
||||
|
||||
const Primitive_id& min_id = min_distance.template get<3>();
|
||||
const Primitive_id& min_id = std::get<3>(min_distance);
|
||||
|
||||
if(accept_if_acute) {
|
||||
// check whether the ray makes acute angle with intersected facet
|
||||
|
|
@ -508,8 +508,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
min_distance.template get<1>() = true; // founded intersection is acceptable.
|
||||
min_distance.template get<2>() = std::sqrt(min_distance.template get<2>());
|
||||
std::get<1>(min_distance) = true; // founded intersection is acceptable.
|
||||
std::get<2>(min_distance) = std::sqrt(std::get<2>(min_distance));
|
||||
|
||||
return min_distance;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue