1
0
mirror of https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git synced 2026-07-26 10:25:49 +00:00
Files
OrcaSlicer-bambulab/src/libigl/igl/copyleft/cgal/hausdorff.cpp
T
tamasmeszaros 2ae2672ee9 Building igl statically and moving to the dep scripts
Fixing dep build script on Windows and removing some warnings.

Use bundled igl by default.

Not building with the dependency scripts if not explicitly stated. This way, it will stay in
Fix the libigl patch to include C source files in header only mode.
2019-06-19 14:52:55 +02:00

40 lines
1.2 KiB
C++

#include "hausdorff.h"
#include "../../hausdorff.h"
#include <functional>
template <
typename DerivedV,
typename Kernel,
typename Scalar>
IGL_INLINE void igl::copyleft::cgal::hausdorff(
const Eigen::MatrixBase<DerivedV>& V,
const CGAL::AABB_tree<
CGAL::AABB_traits<Kernel,
CGAL::AABB_triangle_primitive<Kernel,
typename std::vector<CGAL::Triangle_3<Kernel> >::iterator
>
>
> & treeB,
const std::vector<CGAL::Triangle_3<Kernel> > & /*TB*/,
Scalar & l,
Scalar & u)
{
// Not sure why using `auto` here doesn't work with the `hausdorff` function
// parameter but explicitly naming the type does...
const std::function<double(const double &,const double &,const double &)>
dist_to_B = [&treeB](
const double & x, const double & y, const double & z)->double
{
CGAL::Point_3<Kernel> query(x,y,z);
typename CGAL::AABB_tree<
CGAL::AABB_traits<Kernel,
CGAL::AABB_triangle_primitive<Kernel,
typename std::vector<CGAL::Triangle_3<Kernel> >::iterator
>
>
>::Point_and_primitive_id pp = treeB.closest_point_and_primitive(query);
return std::sqrt((query-pp.first).squared_length());
};
return igl::hausdorff(V,dist_to_B,l,u);
}