// 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 "point_solid_signed_squared_distance.h" #include "points_inside_component.h" #include "point_mesh_squared_distance.h" #include "../../list_to_matrix.h" #include "../../slice_mask.h" #include #include template < typename DerivedQ, typename DerivedVB, typename DerivedFB, typename DerivedD> IGL_INLINE void igl::copyleft::cgal::point_solid_signed_squared_distance( const Eigen::PlainObjectBase & Q, const Eigen::PlainObjectBase & VB, const Eigen::PlainObjectBase & FB, Eigen::PlainObjectBase & D) { // compute unsigned distances Eigen::VectorXi I; DerivedVB C; point_mesh_squared_distance(Q,VB,FB,D,I,C); // Collect queries that have non-zero distance Eigen::Array NZ = D.array()!=0; // Compute sign for non-zero distance queries DerivedQ QNZ; slice_mask(Q,NZ,1,QNZ); Eigen::Array DNZ; igl::copyleft::cgal::points_inside_component(VB,FB,QNZ,DNZ); // Apply sign to distances DerivedD S = DerivedD::Zero(Q.rows(),1); { int k = 0; for(int q = 0;q, -1, 3, 0, -1, 3>, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase, -1, 1, 0, -1, 1> >&); #endif