mirror of https://github.com/CGAL/cgal
Merge pull request #5444 from sgiraudot/Poisson-Kernel_compatibility-GF
[Poisson Reconstruction] Compatibility with Simple Cartesian
This commit is contained in:
commit
3407e3d693
|
|
@ -61,6 +61,17 @@ struct NT_converter < NT1, double >
|
|||
}
|
||||
};
|
||||
|
||||
template < class NT1 >
|
||||
struct NT_converter < NT1, float >
|
||||
: public CGAL::cpp98::unary_function< NT1, float >
|
||||
{
|
||||
float
|
||||
operator()(const NT1 &a) const
|
||||
{
|
||||
return static_cast<float>(to_double(a));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct NT_converter < double, double >
|
||||
: public CGAL::cpp98::unary_function< double, double >
|
||||
|
|
@ -72,6 +83,17 @@ struct NT_converter < double, double >
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct NT_converter < float, float >
|
||||
: public CGAL::cpp98::unary_function< float, float >
|
||||
{
|
||||
const float &
|
||||
operator()(const float &a) const
|
||||
{
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
template < class NT1, bool b >
|
||||
struct NT_converter < NT1, Interval_nt<b> >
|
||||
: public CGAL::cpp98::unary_function< NT1, Interval_nt<b> >
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ compute_average_spacing(const typename NeighborQuery::Kernel::Point_3& query, //
|
|||
boost::make_function_output_iterator
|
||||
([&](const Point& p)
|
||||
{
|
||||
sum_distances += std::sqrt(CGAL::squared_distance (query,p));
|
||||
sum_distances += CGAL::approximate_sqrt(CGAL::squared_distance (query,p));
|
||||
++ i;
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -27,15 +27,16 @@ namespace Poisson {
|
|||
|
||||
template <class Tr>
|
||||
class Constant_sizing_field {
|
||||
double sq_radius_bound;
|
||||
typedef typename Tr::FT FT;
|
||||
FT sq_radius_bound;
|
||||
public:
|
||||
double cell_radius_bound() const { return CGAL::sqrt(sq_radius_bound); }
|
||||
FT cell_radius_bound() const { return CGAL::approximate_sqrt(sq_radius_bound); }
|
||||
|
||||
Constant_sizing_field(double sq_radius_bound = 0.)
|
||||
Constant_sizing_field(FT sq_radius_bound = 0.)
|
||||
: sq_radius_bound(sq_radius_bound) {}
|
||||
|
||||
template <typename Point>
|
||||
double operator()(const Point&) const { return sq_radius_bound; }
|
||||
FT operator()(const Point&) const { return sq_radius_bound; }
|
||||
}; // end class Constant_sizing_field
|
||||
|
||||
} // end namespace Poisson
|
||||
|
|
|
|||
|
|
@ -110,18 +110,19 @@ struct Poisson_visitor {
|
|||
// The wrapper stores only pointers to the two functors.
|
||||
template <typename F1, typename F2>
|
||||
struct Special_wrapper_of_two_functions_keep_pointers {
|
||||
typedef typename F2::FT FT;
|
||||
F1 *f1;
|
||||
F2 *f2;
|
||||
Special_wrapper_of_two_functions_keep_pointers(F1* f1, F2* f2)
|
||||
: f1(f1), f2(f2) {}
|
||||
|
||||
template <typename X>
|
||||
double operator()(const X& x) const {
|
||||
FT operator()(const X& x) const {
|
||||
return (std::max)((*f1)(x), CGAL::square((*f2)(x)));
|
||||
}
|
||||
|
||||
template <typename X>
|
||||
double operator()(const X& x) {
|
||||
FT operator()(const X& x) {
|
||||
return (std::max)((*f1)(x), CGAL::square((*f2)(x)));
|
||||
}
|
||||
}; // end struct Special_wrapper_of_two_functions_keep_pointers<F1, F2>
|
||||
|
|
@ -211,7 +212,7 @@ private:
|
|||
{
|
||||
private:
|
||||
std::atomic<Cache_state> m_state;
|
||||
std::array<double, 9> m_bary;
|
||||
std::array<FT, 9> m_bary;
|
||||
public:
|
||||
Cached_bary_coord() : m_state (UNINITIALIZED) { }
|
||||
|
||||
|
|
@ -242,8 +243,8 @@ private:
|
|||
|
||||
void set_initialized() { m_state = INITIALIZED; }
|
||||
|
||||
const double& operator[] (const std::size_t& idx) const { return m_bary[idx]; }
|
||||
double& operator[] (const std::size_t& idx) { return m_bary[idx]; }
|
||||
const FT& operator[] (const std::size_t& idx) const { return m_bary[idx]; }
|
||||
FT& operator[] (const std::size_t& idx) { return m_bary[idx]; }
|
||||
};
|
||||
|
||||
// Wrapper for thread safety of maintained cell hint for fast
|
||||
|
|
|
|||
|
|
@ -94,9 +94,10 @@ namespace CGAL {
|
|||
typedef typename boost::property_traits<PointMap>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel Kernel;
|
||||
typedef typename Kernel::Sphere_3 Sphere;
|
||||
typedef typename Kernel::FT FT;
|
||||
|
||||
typedef CGAL::Poisson_reconstruction_function<Kernel> Poisson_reconstruction_function;
|
||||
typedef CGAL::Surface_mesh_default_triangulation_3 STr;
|
||||
typedef typename CGAL::Surface_mesher::Surface_mesh_default_triangulation_3_generator<Kernel>::Type STr;
|
||||
typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
|
||||
typedef CGAL::Implicit_surface_3<Kernel, Poisson_reconstruction_function> Surface_3;
|
||||
|
||||
|
|
@ -106,10 +107,10 @@ namespace CGAL {
|
|||
|
||||
Point inner_point = function.get_inner_point();
|
||||
Sphere bsphere = function.bounding_sphere();
|
||||
double radius = std::sqrt(bsphere.squared_radius());
|
||||
FT radius = CGAL::approximate_sqrt(bsphere.squared_radius());
|
||||
|
||||
double sm_sphere_radius = 5.0 * radius;
|
||||
double sm_dichotomy_error = sm_distance * spacing / 1000.0;
|
||||
FT sm_sphere_radius = 5.0 * radius;
|
||||
FT sm_dichotomy_error = sm_distance * spacing / 1000.0;
|
||||
|
||||
Surface_3 surface(function,
|
||||
Sphere (inner_point, sm_sphere_radius * sm_sphere_radius),
|
||||
|
|
|
|||
Loading…
Reference in New Issue