// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 Alec Jacobson // // 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/. #include "swept_volume_signed_distance.h" #include "LinSpaced.h" #include "flood_fill.h" #include "signed_distance.h" #include "AABB.h" #include "pseudonormal_test.h" #include "per_face_normals.h" #include "per_vertex_normals.h" #include "per_edge_normals.h" #include #include #include IGL_INLINE void igl::swept_volume_signed_distance( const Eigen::MatrixXd & V, const Eigen::MatrixXi & F, const std::function & transform, const size_t & steps, const Eigen::MatrixXd & GV, const Eigen::RowVector3i & res, const double h, const double isolevel, const Eigen::VectorXd & S0, Eigen::VectorXd & S) { using namespace std; using namespace igl; using namespace Eigen; S = S0; const VectorXd t = igl::LinSpaced(steps,0,1); const bool finite_iso = isfinite(isolevel); const double extension = (finite_iso ? isolevel : 0) + sqrt(3.0)*h; Eigen::AlignedBox3d box( V.colwise().minCoeff().array()-extension, V.colwise().maxCoeff().array()+extension); // Precomputation Eigen::MatrixXd FN,VN,EN; Eigen::MatrixXi E; Eigen::VectorXi EMAP; per_face_normals(V,F,FN); per_vertex_normals(V,F,PER_VERTEX_NORMALS_WEIGHTING_TYPE_ANGLE,FN,VN); per_edge_normals( V,F,PER_EDGE_NORMALS_WEIGHTING_TYPE_UNIFORM,FN,EN,E,EMAP); AABB tree; tree.init(V,F); for(int ti = 0;ti::infinity(); sqrd = tree.squared_distance(V,F,gv,min_sqrd,i,c); if(sqrd & transform, const size_t & steps, const Eigen::MatrixXd & GV, const Eigen::RowVector3i & res, const double h, const double isolevel, Eigen::VectorXd & S) { using namespace std; using namespace igl; using namespace Eigen; S = VectorXd::Constant(GV.rows(),1,numeric_limits::quiet_NaN()); return swept_volume_signed_distance(V,F,transform,steps,GV,res,h,isolevel,S,S); }