Download vendor/libigl/include/igl/embree/shape_diameter_function.cpp from AVSim/simulation-package: direct link, hf CLI and curl.
- Browser
- Download file 4.54 kB
-
https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/embree/shape_diameter_function.cpp
- Command line
-
hf download hf://datasets/AVSim/simulation-package/vendor/libigl/include/igl/embree/shape_diameter_function.cpp
-
curl -L -o shape_diameter_function.cpp https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/embree/shape_diameter_function.cpp
4.54 kB
| // This file is part of libigl, a simple c++ geometry processing library. | |
| // | |
| // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com> | |
| // | |
| // This Source Code Form is subject to the terms of the Mozilla Public License | |
| // v. 2.0. If a copy of the MPL was not distributed with this file, You can | |
| // obtain one at http://mozilla.org/MPL/2.0/. | |
| template < | |
| typename DerivedP, | |
| typename DerivedN, | |
| typename DerivedS > | |
| IGL_INLINE void igl::embree::shape_diameter_function( | |
| const igl::embree::EmbreeIntersector & ei, | |
| const Eigen::PlainObjectBase<DerivedP> & P, | |
| const Eigen::PlainObjectBase<DerivedN> & N, | |
| const int num_samples, | |
| Eigen::PlainObjectBase<DerivedS> & S) | |
| { | |
| const auto & shoot_ray = [&ei]( | |
| const Eigen::Vector3f& s, | |
| const Eigen::Vector3f& dir)->double | |
| { | |
| igl::Hit hit; | |
| const float tnear = 1e-4f; | |
| if(ei.intersectRay(s,dir,hit,tnear)) | |
| { | |
| return hit.t; | |
| }else | |
| { | |
| return std::numeric_limits<double>::infinity(); | |
| } | |
| }; | |
| return igl::shape_diameter_function(shoot_ray,P,N,num_samples,S); | |
| } | |
| template < | |
| typename DerivedV, | |
| typename DerivedF, | |
| typename DerivedP, | |
| typename DerivedN, | |
| typename DerivedS > | |
| IGL_INLINE void igl::embree::shape_diameter_function( | |
| const Eigen::PlainObjectBase<DerivedV> & V, | |
| const Eigen::PlainObjectBase<DerivedF> & F, | |
| const Eigen::PlainObjectBase<DerivedP> & P, | |
| const Eigen::PlainObjectBase<DerivedN> & N, | |
| const int num_samples, | |
| Eigen::PlainObjectBase<DerivedS> & S) | |
| { | |
| using namespace Eigen; | |
| EmbreeIntersector ei; | |
| ei.init(V.template cast<float>(),F.template cast<int>()); | |
| shape_diameter_function(ei,P,N,num_samples,S); | |
| } | |
| // Explicit template instantiation | |
| template void igl::embree::shape_diameter_function<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&); | |
| template void igl::embree::shape_diameter_function<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&); | |
| template void igl::embree::shape_diameter_function<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&); | |
| template void igl::embree::shape_diameter_function<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&); | |
| template void igl::embree::shape_diameter_function<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&); | |