Download vendor/libigl/include/igl/embree/unproject_onto_mesh.cpp from AVSim/simulation-package: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/embree/unproject_onto_mesh.cpp
- Command line
-
hf download hf://datasets/AVSim/simulation-package/vendor/libigl/include/igl/embree/unproject_onto_mesh.cpp
-
curl -L -o unproject_onto_mesh.cpp https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/embree/unproject_onto_mesh.cpp
1.56 kB
| // This file is part of libigl, a simple c++ geometry processing library. | |
| // | |
| // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@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/. | |
| IGL_INLINE bool igl::embree::unproject_onto_mesh( | |
| const Eigen::Vector2f& pos, | |
| const Eigen::MatrixXi& F, | |
| const Eigen::Matrix4f& model, | |
| const Eigen::Matrix4f& proj, | |
| const Eigen::Vector4f& viewport, | |
| const EmbreeIntersector & ei, | |
| int& fid, | |
| Eigen::Vector3f& bc) | |
| { | |
| using namespace std; | |
| using namespace Eigen; | |
| const auto & shoot_ray = [&ei]( | |
| const Eigen::Vector3f& s, | |
| const Eigen::Vector3f& dir, | |
| igl::Hit & hit)->bool | |
| { | |
| return ei.intersectRay(s,dir,hit); | |
| }; | |
| return igl::unproject_onto_mesh(pos,model,proj,viewport,shoot_ray,fid,bc); | |
| } | |
| IGL_INLINE bool igl::embree::unproject_onto_mesh( | |
| const Eigen::Vector2f& pos, | |
| const Eigen::MatrixXi& F, | |
| const Eigen::Matrix4f& model, | |
| const Eigen::Matrix4f& proj, | |
| const Eigen::Vector4f& viewport, | |
| const EmbreeIntersector & ei, | |
| int& fid, | |
| int& vid) | |
| { | |
| Eigen::Vector3f bc; | |
| if(!igl::embree::unproject_onto_mesh(pos,F,model,proj,viewport,ei,fid,bc)) | |
| { | |
| return false; | |
| } | |
| int i; | |
| bc.maxCoeff(&i); | |
| vid = F(fid,i); | |
| return true; | |
| } | |
| // Explicit template instantiation | |